Jump to content

Saving Radio Button status in an INI


Recommended Posts

... Just about everything.

First, the function you're looking for is GuiCtrlSetState, not GuiSetState. Second, you need to pass it a control ID ($radio1) as the first parameter, then the state ID ($rad1). And last.. what's that -1 in the Checkbox creation for? It's not necessarily wrong, but it's probably not right either.

*Edit: Clarification.

Edited by Saunders
Link to comment
Share on other sites

Here's what i did and it works fine (watch for wrap)

Opt("GuiOnEventMode",1)
GuiCreate("test",200,200)
$radio1 = GUICtrlCreateRadio("", 14, 96, -1, 20)
$rad1 = Iniread("Save.ini","Radio","Radio_1", "4")
if $rad1 = 4 Then
        IniWrite("Save.ini", "Radio", "Radio_1",GUICtrlRead($Radio1))
    EndIf
GuiCtrlSetOnEvent($radio1,"save")
$r1 = GUISetState ($rad1)
GUISetState(@Sw_show)

While 1
    sleep(1000)
WEnd


Func Save()
    IniWrite("Save.ini", "Radio", "Radio_1",GUICtrlRead($Radio1))
EndFunc
Edited by SupraNatural

Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Link to comment
Share on other sites

... Just about everything.

First, the function you're looking for is GuiCtrlSetState, not GuiSetState. Second, you need to pass it a control ID ($radio1) as the first parameter, then the state ID ($rad1). And last.. what's that -1 in the Checkbox creation for? It's not necessarily wrong, but it's probably not right either.

*Edit: Clarification.

<{POST_SNAPBACK}>

Thank you worked fine like you said

$rad1 = Iniread("Save.ini","Radio","Radio_1", "4")
$radio1 = GUICtrlCreateCheckbox ("", 14, 96, -1, 20)
$r1 = GuiCtrlSetState (-1, $rad1)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...