ZenKensei Posted May 28, 2005 Share Posted May 28, 2005 (edited) Group, I'm still trying to understand some of the process flow of the GUI controls. I have a simple (least I think it should be simple) script that I'm working on below. It has 2 radio buttons, 1 input line, and 3 standard buttons. What I'm looking for is as follows: Only 1 radio button pressed at a time (this becomes a variable), the input becomes a variable, and then this information is passed to a function based on the 1 of the 3 standard buttons that is pressed. What I'm having problems with is how to have only one radio button able to be pressed in the group, and how to insure that a radio button has been selected and that input has been entered when one of the 3 standard buttons are pressed. expandcollapse popup#include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("MyGUI", 392, 448,(@DesktopWidth-392)/2, (@DesktopHeight-448)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Group_1 = GuiCtrlCreateGroup("Group1", 60, 90, 270, 50) $Radio_2 = GuiCtrlCreateRadio("Desktop", 90, 110, 80, 20) $Radio_3 = GuiCtrlCreateRadio("Laptop", 210, 110, 90, 20) $Input_4 = GuiCtrlCreateInput("", 130, 170, 140, 20) $Button_5 = GuiCtrlCreateButton("Division 1", 70, 250, 90, 30) $Button_6 = GuiCtrlCreateButton("Division 2", 230, 250, 90, 30) $Button_7 = GuiCtrlCreateButton("Division 3", 150, 310, 90, 30) $Close = GuiCtrlCreateButton("Exit", 150, 380, 90, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = ($Button_5) _Division1($Input_4) Case $msg = ($Button_6) _Division2($Input_4) Case $msg = ($Button_7) _Division3($Input_4) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Close MsgBox(0, "EXIT", "Exiting Pre-Stage Application", 2) Exit EndSelect WEnd;;; Exit Func _Division1($Input_4) MsgBox(0,"Divsion 1", "Division 1 Button Pressed " & $Input_4,5) EndFunc Func _Division2($Input_4) MsgBox(0,"Division 2", "Division 2 Button Pressed " & $Input_4,5) EndFunc Func _Division3($Input_4) MsgBox(0,"Division 3", "Division 3 Button Pressed " & $Input_4,5) EndFunc So if the user selects the 'Desktop' radio button, and then inputs '1234567' as the input (asset tag), this is passed to the function when 1 of the standard buttons is pressed. But there is no action unless a radio button is pressed AND there is input information. Any help would be appreciated as always. Thanks, ZK Edited May 28, 2005 by ZenKensei Link to comment Share on other sites More sharing options...
/dev/null Posted May 28, 2005 Share Posted May 28, 2005 (edited) So if the user selects the 'Desktop' radio button, and then inputs '1234567' as the input (asset tag), this is passed to the function when 1 of the standard buttons is pressed. But there is no action unless a radio button is pressed AND there is input information.maybe something like this?expandcollapse popup#include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("MyGUI", 392, 448,(@DesktopWidth-392)/2, (@DesktopHeight-448)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Group_1 = GuiCtrlCreateGroup("Group1", 60, 90, 270, 50) $Radio_2 = GuiCtrlCreateRadio("Desktop", 90, 110, 80, 20) $Radio_3 = GuiCtrlCreateRadio("Laptop", 210, 110, 90, 20) $Input_4 = GuiCtrlCreateInput("", 130, 170, 140, 20) $Button_5 = GuiCtrlCreateButton("Division 1", 70, 250, 90, 30) $Button_6 = GuiCtrlCreateButton("Division 2", 230, 250, 90, 30) $Button_7 = GuiCtrlCreateButton("Division 3", 150, 310, 90, 30) $Close = GuiCtrlCreateButton("Exit", 150, 380, 90, 30) GuiSetState() While 1 $msg = GuiGetMsg() $input = "" $radio = "" Select Case $msg = ($Button_5) $input = CheckInput() $radio = CheckRadio() if $radio <> "" AND $input <> "" then _Division1($input,$radio) else msgbox(4096, "Error", "Sorry: Please enter some data") endif Case $msg = ($Button_6) $input = CheckInput() $radio = CheckRadio() if $radio <> "" AND $input <> "" then _Division2($input,$radio) else msgbox(4096, "Error", "Sorry: Please enter some data") endif Case $msg = ($Button_7) $input = CheckInput() $radio = CheckRadio() if $radio <> "" AND $input <> "" then _Division3($input,$radio) else msgbox(4096, "Error", "Sorry: Please enter some data") endif Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Close MsgBox(0, "EXIT", "Exiting Pre-Stage Application", 2) Exit EndSelect WEnd;;; Exit Func CheckRadio() if GUICtrlRead($Radio_2) = $GUI_CHECKED then $radio = "Desktop" elseif GUICtrlRead($Radio_3) = $GUI_CHECKED then $radio = "Laptop" else $radio = "" endif return $radio EndFunc Func CheckInput() $input = GUICtrlRead($Input_4) return $input EndFunc Func _Division1($Input,$Radio) MsgBox(0,"Divsion 1", "Division 1 Button Pressed " & $Input & " " & $Radio,5) EndFunc Func _Division2($Input,$Radio) MsgBox(0,"Divsion 2", "Division 2 Button Pressed " & $Input & " " & $Radio,5) EndFunc Func _Division3($Input,$Radio) MsgBox(0,"Divsion 3", "Division 3 Button Pressed " & $Input & " " & $Radio,5) EndFuncCheersKurt Edited May 28, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
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