Fossil Rock Posted October 20, 2006 Share Posted October 20, 2006 I thought this was clever so I added it here. expandcollapse popup#include <GUIConstants.au3> Opt("WinTitleMatchMode", 2) Opt("GUIOnEventMode", 1) $title = "Option " $Choices = 5 $Counter = 0 Dim $Radio[31] $GUI = GUICreate(" Radio Button Selector", 170, ($Choices * 20) + 65, -1, -1, "", $WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Done") GUICtrlCreateLabel("Make a Selection", 10, 10) MakeChoices() GUISetState(@SW_SHOW) List1() Func List1() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Done() EndSelect Wend EndFunc Func MakeChoices() For $Counter = 1 To $Choices $Radio[$Counter] = GUICtrlCreateRadio($title & $Counter & " ", 10, ($Counter * 20) + 10) GUICtrlSetOnEvent(-1, "SetTitle") Next EndFunc Func SetTitle() WinSetTitle(" ", "", " " & ControlGetText("","",@GUI_CtrlId) & "Selected") EndFunc Func Done() MsgBox(0,"", "Change the $Choices value and see what happens.") Exit EndFunc Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
erikson Posted February 5, 2007 Share Posted February 5, 2007 (edited) nice script but if you selected radio 3 for example, how do you make to do something? LE: Like Func MakeChoices() For $Counter = 1 To $Choices $Radio[$Counter] = GUICtrlCreateRadio($title & $Counter & " ", 10, ($Counter * 20) + 10) GUICtrlSetOnEvent(-1, "runs") Next EndFunc Func runs() if $Radio[$Counter] = GUICtrlCreateRadio("key2", 10, 50) Then <----what you must put here (instead "key2", 10, 50 ) MsgBox (0, "1", "OK. Match") Else MsgBox (0, "2", "Not a match") EndIf EndFunc where Key is title and 2 is the option Edited February 5, 2007 by erikson Link to comment Share on other sites More sharing options...
Fossil Rock Posted February 7, 2007 Author Share Posted February 7, 2007 Look at the Function Call in the help file. Hope this helps.expandcollapse popup#include <GUIConstants.au3> Opt("WinTitleMatchMode", 2) Opt("GUIOnEventMode", 1) $title = "Option " $Choices = 5 $Counter = 0 Dim $Radio[31] $GUI = GUICreate(" Radio Button Selector", 170, ($Choices * 20) + 65, -1, -1, "", $WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Done") GUICtrlCreateLabel("Make a Selection", 10, 10) MakeChoices() GUISetState(@SW_SHOW) List1() Func List1() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Done() EndSelect Wend EndFunc Func MakeChoices() For $Counter = 1 To $Choices $Radio[$Counter] = GUICtrlCreateRadio($title & $Counter & " ", 10, ($Counter * 20) + 10) GUICtrlSetOnEvent(-1, "SetTitle") Next EndFunc Func SetTitle() WinSetTitle(" ", "", " " & ControlGetText("","",@GUI_CtrlId) & "Selected") $Box = "Option" & @GUI_CtrlId - 3 Call($Box) EndFunc Func Done() ; MsgBox(0,"", "Change the $Choices value and see what happens.") Exit EndFunc Func Option1() MsgBox (0,"", "Option " & @GUI_CtrlId - 3 & " Selected") EndFunc Func Option2() MsgBox (0,"", "Option " & @GUI_CtrlId - 3 & " Selected") EndFunc Func Option3() MsgBox (0,"", "Option " & @GUI_CtrlId - 3 & " Selected") EndFunc Func Option4() MsgBox (0,"", "Option " & @GUI_CtrlId - 3 & " Selected") EndFunc Func Option5() MsgBox (0,"", "Option " & @GUI_CtrlId - 3 & " Selected") EndFunc Agreement is not necessary - thinking for one's self is! 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