Default Focus in Dialog Box?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Default Focus in Dialog Box?

Post by dbish » Tue Apr 13, 2004 5:46 pm

I have a Dialog Box which loads with many, many check boxes and user input fields. I use the mouse to move around and make my changes to checkbox settings and to go to user input fields. (Dialog box input gathers variables for graphing routine).

Is there some way to have a default focus set to the OKAY button so that whenever I hit Enter on the keyboard the dialog would do what the OKAY Button is set to (and process the dialog box)?

Thanks

Dave

Lumumba

Post by Lumumba » Tue Apr 13, 2004 8:24 pm

Have you checked if this MSched command will work: MouseOver>window_title,button/object_caption :?:

eg.
MouseOver>*,OK

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Apr 13, 2004 10:40 pm

Is there some way to have a default focus set to the OKAY button so that whenever I hit Enter on the keyboard the dialog would do what the OKAY Button is set to (and process the dialog box)?
It sounds like you just want to close the Dialog box and continue the script using the values from the dialog box. You want to do this using the Enter key on the keyboard, vs. using the mouse to click on OKAY button?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Wed Apr 14, 2004 3:50 pm

Bob has got what I want to do correct. If I
1. move the mouse over the OKAY button / Click
OR
2. if I hit ENTER on the Keyboard

-- I want to close the dialog box and continue my script.


Lumumba's approach saves me having to click but doesn't handle the Enter via keyboard.


any ideas on how to do this?

Thanks

Dave

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Apr 14, 2004 3:57 pm

Three quick untested thoughts:

1. I haven't tried this, and it is not conventional layout, but have you tried putting the OKAY button as the first object on the Dialog? If the cursor normally goes to the first object, then pressing ENTER may activate the button. Of course this would have to then use all the default values of the combo boxes, text fields, etc.

2. But if putting the OKAY button near bottom. why can't you just press the Tab key until OKAY is active, then press ENTER?

3. Will CTL-END go to the last object on the Dialog? If yes, then make the last object the OKAY button. From anywhere in the dialog, press CTL-END, ENTER.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Wed Apr 14, 2004 7:37 pm

I will play with idea one. The whole point of the enter key is that I often change one input and hit enter without even having to look at the keyboard. If I have to think about clicking tab the right number of times then enter it defeats the purpose This is not a disability related problem - I am just lazy !

The Ctrl-End didn't do anything.

I was hoping that there would be some (maybe undocumented) focus property like the controls in Visual Basic for Applications (excel macros - my only other real programming).

I will play around and let you know.

Thanks for the reply.

Dave

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Thu Apr 15, 2004 5:18 am

Back to the drawing board!

The placement of the Okay button as the first object allowed the focus to be initially set on it but as soon as I changed any of the other 50 checkbox / user input objects the focus then was set there and ENTER does nothing.

I am guessing that, without a formal focus property (Hint: Marcus) I will fail on this improvement.

I just had a thought - is there a way to set a variable that captures all user input so that "Ctrl F12" or "ENTER" could be identified from keystrokes? It would have to active while the dialog box is on the screen (I am guessing that it would work easier if it was in a regular script - just test on each Input> occurrence). This might work for my project.

Until later,

Dave

P.S. - I haven't been getting email notification of replies on this thread. Anybody else noticed that in the last 24 hours or is it my ISP at fault?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Apr 15, 2004 2:38 pm

I have been receiving email notices on this subject.

Did you check the box in the options? If not, you can edit your posting and update the checkbox.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts