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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Focus

Status
Not open for further replies.

flea333

Technical User
Sep 4, 2003
47
US
I have a dialog box with buttons. When my program opens the dialog box, I want to activate the keyboard shortcuts by pressing ALT, so I use sendkey ALT 0x05, where 0x05 is nothing since I don't know any way to send just ALT. But now I want to put the default focus on a button. I put DEFAULT in the program, but that doesn't seem to work. I think the fact that I did the sendkey ALT 0x05 makes it focus on the first tab ordered element. Is there a way to change the focus to another button?
 
I haven't tested this theory in depth, but I believe the first control listed in the dialogbox command is the one that will receive focus, so you might try reordering the controls in your script so that the button you want to have focus is first. You can also use the Dialog Editor (Tools | Scripts | Dialog Editor) to reorder the controls. To do so, copy the dialogbox commands into the Dialog Editor and select Layout | Tab Order. A numbered box will be displayed by each control, indicating in what order pressing the tab key would navigate through the dialog. You can change the order by clicking on each control in turn. Once you have everything as you like it, you can select Edit | Copy Dialog, then paste the updated dialog back into your script.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top