Solved

Active X edit control

Posted on 1998-10-21
7
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Technology Partners: 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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

705 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