Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Focus

Status
Not open for further replies.

trent101

Programmer
Nov 4, 2005
50
0
0
AU
I have a password dialog box thathas a edit box on it, it works fine but what i want is for the text box to have automatic focus when it loads so the user does not have to click in it. I have tried creating a variable for the edit box, and using the setfocus() function, but when i do this I get an assertion error. This code I placed in the dialog boxes constructor. Anyone got any ideas?
 
Yes, an easy way to set focus is to use the Layout feature to make it number one on the tab sequence for your dialog.
 
Try placing the setfocus() in the OnInitDialog(). You can't put it in the constructor for the dialog box because the edit box is not initialized yet.

HyperEngineer
If it ain't broke, it probably needs improvement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top