Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Active X edit control

Posted on 1998-10-21
7
Medium Priority
?
288 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
ID: 1323613
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
ID: 1323614
Why don't you just use a normal Windows Edit control ?
Use SetWindowPos or MoveWindow etc. to move it


0
 

Author Comment

by:manx
ID: 1323615
The Microsoft Forms TextBox is actually the standard windows edit control.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:rosborn051498
ID: 1323616
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
ID: 1323617
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 300 total points
ID: 1323618
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
ID: 1323619
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
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…

963 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