Default Button in Dialog BoxI am trying to set the "OK" button as the default (highlighted) tool in a modal dialog box. Any suggestions?
I am trying to make it so easy for the user, that when the dialog appears, they can just hit the "Enter" button on their keyboard to accept the prefilled values in the number box.
Thank you!
Re: Default Button in Dialog BoxThanks Mark. Not exactly the solution I was hoping for, but it will work for now. It would be nice if a "set focus" command was available.
Maybe in JMP 16 :-).Re: Default Button in Dialog BoxThey just have to hit enter twice. The first time will complete the entry in the first box. The second time will dismiss the dialog as if they clicked OK.
dialog = New Window( "Test", << Modal,
Panel Box( "Enter Numbers Here!",
Line Up Box( N Col( 2 ),
Text Box( "Low" ),
low neb = Number Edit Box( 0 ),
Text Box( "Middle" ),
mid neb = Number Edit Box( 50 ),
Text Box( "High" ),
high neb = Number Edit Box( 100 )
)
),
H List Box(
Button Box( "OK",
low = low neb << Get;
mid = mid neb << Get;
high = high neb << Get;
),
Button Box( "Cancel" )
)
);
If( dialog["Button"] == -1, Throw( "User cancelled" ) );
Show( low, mid, high );
Re: Default Button in Dialog BoxThanks pmroz.
This would seem to be an oversight and should be "fixed", IMHO.
Re: Default Button in Dialog BoxThe only setfocus method is for a mousebox. If you don't have that many inputs you could train your users to hit tab until OK is highlighted and then the spacebar.