ColoradoDon Posted February 11, 2005 Posted February 11, 2005 Hi, I'm trying to present the user of the script with a choice between two options. Initially, I don't want an option set between two radio buttons. I need to test for whether they left both radio buttons unset when the click on OK. What I have at present is a default case statement, but I don't know how to call the GUI back once I display the MsgBox. I have a gut feeling that this is something I can test for before calling the OKButton function, but I'm not sure how. Any help to put me on the right path would be appreciated.WinMinimizeAll()Opt("GUIOnEventMode",1) ; Change to OnEvent mode GUICreate("Which Print Bay?",200,150) GUICtrlCreateLabel("Please choose which printer",30,10) GUICtrlCreateLabel("bay you are installing",30,25) $radio1 = GUICtrlCreateRadio("Bay 1 (West, Pole 05E) ",40,50) GUICtrlSetState($radio1, $GUI_ENABLE) $radio2 = GUICtrlCreateRadio("Bay 2 (East, Pole 11E) ",40,70) GUICtrlSetState($radio2, $GUI_UNCHECKED) $okbutton = GUICtrlCreateButton("OK",30,110,50) $cancelbutton = GUICtrlCreateButton("Cancel",120,110,50) GuiCtrlSetOnEvent($okbutton, "OKButton") GuiCtrlSetOnEvent($cancelbutton, "CancelButton") GUISetState(@SW_SHOW)While 1 Sleep(1000)WEnd; =========; Functions; =========Func OKButton() Select Case GUICtrlRead($radio1) = $GUI_CHECKED CheckOS(1) Case GUICtrlRead($radio2) = $GUI_CHECKED CheckOS(2) Case Else MsgBox(0,"Error","You need to select either Bay 1 or Bay 2") EndSelect WinMinimizeAllUndo() ExitEndFuncFunc CancelButton() WinMinimizeAllUndo() ExitEndFunc
CyberSlug Posted February 11, 2005 Posted February 11, 2005 Adjust Func OKButton(). Only call Exit inside a case-statement where the button is checked. You were calling Exit in all circumstances: Func OKButton() Select Case GUICtrlRead($radio1) = $GUI_CHECKED CheckOS(1) WinMinimizeAllUndo() Exit Case GUICtrlRead($radio2) = $GUI_CHECKED CheckOS(2) WinMinimizeAllUndo() Exit Case Else MsgBox(0,"Error","You need to select either Bay 1 or Bay 2") EndSelect EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
ColoradoDon Posted February 11, 2005 Author Posted February 11, 2005 Thank you, thank you, thank you. I had a feeling it was something simple and easy. And you were completely right.
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