please see the comments at the start of the code:
Code: Select all
; Test set radio buttons - simplified for tests
; Init: two tabs with 3 Radios each, first checked each
; OK hides it
; Alt + F12 restores it
; Alt+F10 checks radio 2 in tab1, unchecks radio 1
; Alt+F11 checks radio 3 in tab2, unchecks radio 1
;
; My problem: Works in tab1 - radio 1 in tab2 stays also checked
; Btw: same in additional tabs 3, 4, 5 ...
global guiRbs
global rbs1 := Array()
global rbs2 := Array()
SetIniButtons()
{
global
rbs1.Length := 3
rbs2.Length := 3
guiRbs := Gui(, "Buttons")
guiRbs.SetFont("s16" ,"Arial")
tab := guiRbs.Add("Tab3", "", ["Tab1","Tab2"])
tab.Move(, , 500, )
tab.UseTab(1)
rbs1[1] := guiRbs.Add("Radio", "vTab1 Checked", "First")
rbs1[2] := guiRbs.Add("Radio", " ", "Second")
rbs1[3] := guiRbs.Add("Radio", " ", "Third")
tab.UseTab(2)
rbs2[1] := guiRbs.Add("Radio", "vTab2 Checked", "First")
rbs2[2] := guiRbs.Add("Radio", " ", "Second")
rbs2[3] := guiRbs.Add("Radio", " ", "Third")
tab.UseTab() ;
okBtn := guiRbs.Add("Button", "section xm default", "&OK")
okBtn.OnEvent("Click", guiRbsHide)
guiRbs.OnEvent("Close", guiRbsEnd)
guiRbs.Show()
guiRbsHide(this, *)
{
if (this is Gui.Control) ; if the Button(or any other Control) was passed in
this := this.Gui ; get the Gui object, the control belongs to, instead
this.Hide
}
guiRbsEnd(this, *)
{
if (this is Gui.Control) ; if the Button(or any other Control) was passed in
this := this.Gui ; get the Gui object, the control belongs to, instead
this.Destroy
}
}
SetIniButtons()
!F10::
{
ControlSetChecked(true, rbs1[2] )
ControlSetChecked(false, rbs1[1] )
}
!F11::
{
ControlSetChecked(true, rbs2[3] )
ControlSetChecked(false, rbs2[2] )
}
!F12::
{
guiRbs.Restore()
}