Jump to content

Read if radio is selected


Recommended Posts

Hello all,

I have a question:

I am trying to read if an radio button is selected through an .ini file

Below are some code snippets

Radio_2 = GUICtrlCreateRadio(" ", 180,115)

If FileExists($iniPath) Then
    $viewRadio = IniRead($iniPath, "colors", "radio", "Not Found")
    ;MsgBox(4096, "Result", $viewRadio, "Not found")
    GUICtrlSetState($viewRadio , $GUI_CHECKED)
EndIf

The .ini file looks like this :

[colors]
radio=$radio_2

I can read the value when i use the MsgBox but when i use the GUICtrlSetState the radio is not selected when i run the program.

Maybe i am doing something wrong here, but i can't figure out what...

Cheers,

johnnyBravo

Edited by johnnybravo
Link to comment
Share on other sites

I just solved the problem myself. (for the first time ;) )

Before i used the code below to save the radio state:

If GUICtrlRead($radio_2) = 1 Then IniWrite($iniPath, "colors", "radio", "$radio_2")

And changed it to:

If GUICtrlRead($radio_2) = 1 Then IniWrite($iniPath, "colors", "radio", $radio_2)

The only thing i had to do was removing the "" around $radio_2 , :blink:

Hope it could be usefull for some of you guys that are facing the same problem..

Edited by johnnybravo
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...