litlmike Posted April 11, 2006 Posted April 11, 2006 (edited) When I {TAB} through the 3 buttons on the GUI, and press {ENTER}, I would like the GUI to select/click the button highlighted. It doesn't do that now, how come? *************EDIT************** Or another way to ask this! How do I change the Push Button from {SPACEBAR} to {ENTER}? I notice in the GUI that {SPACEBAR} will select the button the user is highlighted on, but how can I make that the {ENTER} key instead? expandcollapse popupFunc GUI_Time_Slots () GuiCreate("MyGUI", 392, 200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 100, 50) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 100, 50) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_830 () Case $msg = $Button_2 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_1100 () Case $msg = $Button_3 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_1315 () EndSelect WEnd Return EndFunc Func Time_Slot_830 () BlockInput (1) Sleep (100) Send ("0830a") BlockInput (0) Return EndFunc Func Time_Slot_1100 () BlockInput (1) Sleep (100) Send ("1100a") BlockInput (0) Return EndFunc Func Time_Slot_1315 () BlockInput (1) Sleep (100) Send ("0115p") BlockInput (0) Return EndFunc Edited April 11, 2006 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF
Moderators SmOke_N Posted April 11, 2006 Moderators Posted April 11, 2006 Take a look at $BS_DEFPUSHBUTTON in the help file under GUI Control Styles. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
litlmike Posted April 11, 2006 Author Posted April 11, 2006 Take a look at $BS_DEFPUSHBUTTON in the help file under GUI Control Styles. I changed it to this, does this seem right? It looks kinda ugly, but it does seem to work from my prelim testing. $Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 110, 50, -1, $BS_DEFPUSHBUTTON) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50, -1, $BS_DEFPUSHBUTTON) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 110, 50, -1, $BS_DEFPUSHBUTTON) _ArrayPermute()_ArrayUnique()Excel.au3 UDF
Moderators SmOke_N Posted April 11, 2006 Moderators Posted April 11, 2006 I changed it to this, does this seem right? It looks kinda ugly, but it does seem to work from my prelim testing. $Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 110, 50, -1, $BS_DEFPUSHBUTTON) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50, -1, $BS_DEFPUSHBUTTON) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 110, 50, -1, $BS_DEFPUSHBUTTON)It's not an extended style, it's a style:$Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 110, 50, $BS_DEFPUSHBUTTON) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 110, 50)Is all you should need . Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
litlmike Posted April 11, 2006 Author Posted April 11, 2006 It's not an extended style, it's a style:$Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 110, 50, $BS_DEFPUSHBUTTON) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 110, 50)Is all you should need . Hmmm... it seems that $BS_DEFPUSHBUTTON is a Default Button command. In that, whenever I press enter, it will select/click the button that is assigned as $BS_DEFPUSHBUTTON. But in this case, I am not looking for a default push button, I am just looking to push the button that the user has tabbed onto. The GUI in the original post, did not do that. Is there another way to assign the buttons? _ArrayPermute()_ArrayUnique()Excel.au3 UDF
litlmike Posted April 11, 2006 Author Posted April 11, 2006 Or another way to ask this! How do I change the Push Button from {SPACEBAR} to {ENTER}? I notice in the GUI that {SPACEBAR} will select the button the user is highlighted on, but how can I make that the {ENTER} key instead? _ArrayPermute()_ArrayUnique()Excel.au3 UDF
Valuater Posted April 11, 2006 Posted April 11, 2006 expandcollapse popup#include <GUIConstants.au3> Func GUI_Time_Slots () GuiCreate("MyGUI", 392, 200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GuiCtrlCreateButton("8:30 Time Slot", 20, 90, 100, 50) GUICtrlSetState( -1,$GUI_DEFBUTTON) $Button_2 = GuiCtrlCreateButton("11:00 Time Slot", 150, 90, 110, 50) $Button_3 = GuiCtrlCreateButton("1:15 Time Slot", 280, 90, 100, 50) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_830 () Case $msg = $Button_2 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_1100 () Case $msg = $Button_3 GuiSetState ( @SW_HIDE ) Sleep (200) Time_Slot_1315 () EndSelect WEnd Return EndFunc Func Time_Slot_830 () BlockInput (1) Sleep (100) Send ("0830a") BlockInput (0) Return EndFunc Func Time_Slot_1100 () BlockInput (1) Sleep (100) Send ("1100a") BlockInput (0) Return EndFunc Func Time_Slot_1315 () BlockInput (1) Sleep (100) Send ("0115p") BlockInput (0) Return EndFunc 8)
litlmike Posted April 11, 2006 Author Posted April 11, 2006 8)Valuater to the resuce! Case closed - Thanks. _ArrayPermute()_ArrayUnique()Excel.au3 UDF
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now