Phaser Posted September 2, 2009 Share Posted September 2, 2009 Hi everyone I need to set 3 options via radio buttons to set $mode expandcollapse popup#include <GUIConstantsEx.au3> HotKeySet("{ESC}", "killit") Opt("GUIOnEventMode", 1) GUICreate("Data Tool", 340, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "killit") GUICtrlCreateLabel("Start?", 150, 35) $okbutton = GUICtrlCreateButton("Yes", 152, 70, 60) GUICtrlSetOnEvent($okbutton, "goforit") $cancelbutton = GUICtrlCreateButton("Close", 245, 70, 60) GUICtrlSetOnEvent($cancelbutton, "killit") $checkbox = GUICtrlCreateCheckbox("Tick to stop", 240, 33, 120, 20) GuiCtrlCreateGroup("Select Mode", 20, 10,110,110) $radio1 = GuiCtrlCreateRadio("Soft", 40, 30, 80) GuiCtrlSetState($radio1, $GUI_CHECKED) $radio2 = GuiCtrlCreateRadio("Medium", 40, 55, 80) $radio3 = GuiCtrlCreateRadio("Hard", 40, 80, 80) GUICtrlCreateGroup ("",-99,-99,1,1) GUISetState() $msg = GUIGetMsg() Select Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED $mode = 1 Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED $mode = 2 Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED $mode = 3 EndSelect Global $mode,$radio1,$radio2,$radio3 While 1 Sleep(1000) WEnd Func goforit() While 1; the main loop, everything happens within here MsgBox(0,"box name", "Mode " & $mode,2) ;check if we need to stop if BitAnd(GUICtrlRead($checkbox), $GUI_CHECKED) = True Then ExitLoop EndIf WEnd ; end of main loop EndFunc Func killit() Exit EndFunc I have tried a few different ways but don't get any response? hopefully someone can see where I went wrong, the $mode value needs to be global as it is called via an included file. Link to comment Share on other sites More sharing options...
99ojo Posted September 2, 2009 Share Posted September 2, 2009 Hi, like this? Only the 1.st part until Function goforit. #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "killit") Global $mode,$radio1,$radio2,$radio3 Opt("GUIOnEventMode", 1) GUICreate("Data Tool", 340, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "killit") GUICtrlCreateLabel("Start?", 150, 35) $okbutton = GUICtrlCreateButton("Yes", 152, 70, 60) GUICtrlSetOnEvent($okbutton, "goforit") $cancelbutton = GUICtrlCreateButton("Close", 245, 70, 60) GUICtrlSetOnEvent($cancelbutton, "killit") $checkbox = GUICtrlCreateCheckbox("Tick to stop", 240, 33, 120, 20) GuiCtrlCreateGroup("Select Mode", 20, 10,110,110) $radio1 = GuiCtrlCreateRadio("Soft", 40, 30, 80) GuiCtrlSetState($radio1, $GUI_CHECKED) $radio2 = GuiCtrlCreateRadio("Medium", 40, 55, 80) $radio3 = GuiCtrlCreateRadio("Hard", 40, 80, 80) GUICtrlCreateGroup ("",-99,-99,1,1) GUISetState() $msg = GUIGetMsg() While 1 Select Case GUICtrlRead($radio1) = $GUI_CHECKED $mode = 1 Case GUICtrlRead($radio2) = $GUI_CHECKED $mode = 2 Case GUICtrlRead($radio3) = $GUI_CHECKED $mode = 3 EndSelect Sleep(1000) ConsoleWrite ($mode); Only for debugging...... WEnd ;-)) Link to comment Share on other sites More sharing options...
Phaser Posted September 2, 2009 Author Share Posted September 2, 2009 Thanks 99ojo, glad to see I was sort of almost there Link to comment Share on other sites More sharing options...
Manjish Posted September 2, 2009 Share Posted September 2, 2009 Here: expandcollapse popup#include <GUIConstantsEx.au3> HotKeySet("{ESC}", "killit") ;Opt("GUIOnEventMode", 1) GUICreate("Data Tool", 340, 130) ;GUISetOnEvent($GUI_EVENT_CLOSE, "killit") GUICtrlCreateLabel("Start?", 150, 35) $okbutton = GUICtrlCreateButton("Yes", 152, 70, 60) ;GUICtrlSetOnEvent($okbutton, "goforit") $cancelbutton = GUICtrlCreateButton("Close", 245, 70, 60) GUICtrlSetOnEvent($cancelbutton, "killit") $checkbox = GUICtrlCreateCheckbox("Tick to stop", 240, 33, 120, 20) GuiCtrlCreateGroup("Select Mode", 20, 10,110,110) $radio1 = GuiCtrlCreateRadio("Soft", 40, 30, 80) GuiCtrlSetState($radio1, $GUI_CHECKED) $radio2 = GuiCtrlCreateRadio("Medium", 40, 55, 80) $radio3 = GuiCtrlCreateRadio("Hard", 40, 80, 80) GUICtrlCreateGroup ("",-99,-99,1,1) GUISetState() GUISetState(@sw_show) Global $mode,$radio1,$radio2,$radio3 While 1 $msg = GUIGetMsg() Switch $msg Case $gui_event_close killit() Case $okbutton if BitAnd(GUICtrlRead($checkbox), $GUI_CHECKED) = True Then ExitLoop EndIf For $i=1 to 3 $rad=eval("radio"&$i) If GUICtrlRead($rad)=$gui_checked Then $mode=$i MsgBox(0,"box name", "Mode " & $mode,2) EndIf Next EndSwitch WEnd Func killit() Exit EndFunc [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com 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