Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Cursor Positioning

Hi all,

I have created a dialog box with few edit controls in it. When the application runs the cursor parks on OK button. I want it to park on one of the edit controls. How should I do that?

Thanks
0
Mayflower1
Asked:
Mayflower1
  • 2
1 Solution
 
KurtVonCommented:
Do you mean the OK button is the active control?  The easiest way to make a particular control active is to just make it first in the tab order.

If you mean the mouse cursor, first you have to disable the code that is currently moving it, and then call SetCursorPos with the position you want in a place that gets called automatically right after the window is displayed for the first time.  Offhand, I'd think in the WM_ONERASEBACKGROUND handler with a bool to detect whether this is the first time it is called.
0
 
PriyeshCommented:
GoToDlgCtrl(GetDlgItem(IDC_EDIT1)) ;
0
 
KurtVonCommented:
If you do use GoToDlgCtrl you will need to do it in the OnInitDialog handler and change the handler to return FALSE.

Like I said, it may be easier to just change the tab order.
0
 
sreenu_v78Commented:
Hai,
Set the Tab Order in design time,
to do this.


Use(CTRL+A) Select the all Controls in Dialog.
Press (CTRL+D) for show the tab order.

change the tab order as ur wish.

Other wise

Use SetFocus() in coding

best wishes
sreenu.
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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now