Solved

Active X edit control

Posted on 1998-10-21
7
271 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstChar challenge 13 135
What is MicroStrategy.NET? 2 83
VS2015 Redefinition errors 4 91
Please explain the parts of these 2 LINQ expressions 3 87
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
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…

730 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