Solved

Active X edit control

Posted on 1998-10-21
7
254 Views
Last Modified: 2013-11-25
I am currently writing an app that needs text to be entered directly to the display. I have tried using an activex edit box to enter the text and it works just fine. However now I need to be able to select the control, move and resize the control during execution time. Any idea how I can go about doing this ? These controls are created and added during run time.

I am using VC++ 5.0 and the activex control used is Microsoft Forms 2.0 Textbox. Is there a better alternative control out there ?
0
Comment
Question by:manx
7 Comments
 
LVL 1

Expert Comment

by:Bridge
Comment Utility
When you create the control at runtime I assume you have a CWnd* to it. (CWnd::CreateControl(...))
Can't you use that ??

CWnd::SetFocus();
CWnd::SetWindowPos(...);
..
0
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
Why don't you just use a normal Windows Edit control ?
Use SetWindowPos or MoveWindow etc. to move it


0
 

Author Comment

by:manx
Comment Utility
The Microsoft Forms TextBox is actually the standard windows edit control.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Expert Comment

by:rosborn051498
Comment Utility
Actually, I believe the CEdit control is the "standard" windows edit control.  Try using SetFocus and SetWindowPos as Bridge suggested.  By using the MFC CEdit control, you won't have to redistribute an ActiveX control.
0
 

Expert Comment

by:aasif
Comment Utility
Where are you using ActiveX Edit Control? in Dialog Application or App Wizard Generated project? In MFC Environment ideal solution is CEdit class. This class encapsolates the normal window's Edit control. Consult MoveWindows, SetWindowPos methods in VC++ help.
0
 

Accepted Solution

by:
rakeshkalra earned 100 total points
Comment Utility
You use a CEdit control class. If you are placing the control using the VC++ resource editor, create a variable of type 'control' for this edit box in the 'Member Variables' tab of 'Class Wizard'. This will give you an object of class CEdit. Using this object you can call 'MoveWindow' to size the window or call 'SetWindowPos' to move the window.

Now your control can have two states: one when it is selected for resizing or moving and second when its working normally. You can provide an option like double clicking or clicking the mouse with some key like shift or ctrl down. When you get this message you can change the state of your control from normal to selected. Similarly for some other message like right mouse click or mouse click with some key, you change the state back to normal.

Now you have a bool variable that keeps the state of your control. When the state is "selected" you capture mouse events like WM_MOUSEMOVE with WM_LBUTTONDOWN. In this case you move the control using SetWindowPos. You can check the position of mouse cursor when it started moving and move the window relative to the mouse cursor movement. You will have to get the mouse position when in the selected state. When the mouse is over the border you change the cursor to 'sizing cursor' and when its a sizing cursor and you get mouse move with L button down message you resize the window using MoveWindow in the direction the mouse is being moved. Similarly when the mouse cursor is inside the control change it to 'move cursor' and move the control using SetWindowPos.

This will take some effort but it will definitly solve your problem.
0
 

Author Comment

by:manx
Comment Utility
Good answer. Managed to figure out some of it myself from the tips previously recieved, Your ans completed the rest of the puzzle.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now