?
Solved

Active X edit control

Posted on 1998-10-21
7
Medium Priority
?
280 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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 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.

777 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