Jump to content
Sign in to follow this  
shay

Help with using Radio button in GUI

Recommended Posts

shay

Hi

i need some help in Radio button in GUI (didn't understand the Radio/GUI completely :) )

i use the above script to update INI files

i want to use the radio button to select additional parameters

exsampel

select client and radio 1 = 1

select client and radio 2 = 1.5

select server = 3

#include <GuiConstantsEx.au3>
#include <File1.au3>

GuiCreate("set debug",318,131,14,10)
$button1=GuiCtrlCreateButton("server",16,44,79,83)
$button2=GuiCtrlCreateButton("client",106,43,90,83)
$label1=GuiCtrlCreateLabel("Select unit type",25,14,216,15)
$label2=GuiCtrlCreateLabel("v5.0 ",270,1,55,15)
GuiSetState()

;Radio Button
GuiCtrlCreateGroup("Client Verbose:", 200, 40)
$Radio1 = GuiCtrlCreateRadio("Radio 1", 210, 60, 80)
GuiCtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GuiCtrlCreateRadio("Radio 2", 210, 80, 80)

While 1
$msg=GuiGetMsg()
If $msg=-3 Then Exit
If $msg=$button1 Then button1()
If $msg=$button2 Then button2()
;If $msg=$button3 Then button3()
Wend


Func button1()
    ;some code here
EndFunc


Func button2()
    ;some code here
    ;if radio 1..... then
    ;if radio 2 ....then

EndFunc

"If the facts don't fit the theory, change the facts." Albert Einstein

Share this post


Link to post
Share on other sites
water

OK, but what's the problem? You are talking about ini files but your example doesn't contain any code reading/writing ini files.

So could you please post the complete code and describe the problem you are facing as exactly as possible.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
shay

OK, but what's the problem? You are talking about ini files but your example doesn't contain any code reading/writing ini files.

So could you please post the complete code and describe the problem you are facing as exactly as possible.

the problem it that i didnt understand how to use the radio button,

i want to use the radio button in something like that:

lets say the user select "Client" and Radio 1

then it will update the INI file to option 1

if user select Radio 2 it will update the INI with option 2

:) i`m didn't add the full script because of my concern of privacy.

Edited by shay

"If the facts don't fit the theory, change the facts." Albert Einstein

Share this post


Link to post
Share on other sites
water

I would do it this way:

#include <GuiConstantsEx.au3>
#include <File.au3>

GUICreate("set debug", 318, 181, 14, 10)
$label1 = GUICtrlCreateLabel("Select unit type", 25, 14, 216, 15)
$label2 = GUICtrlCreateLabel("v5.0 ", 270, 1, 55, 15)

;Radio Button
GUICtrlCreateGroup("Select System:", 10, 40, 100, 85)
$Radio11 = GUICtrlCreateRadio("Server", 20, 60, 80)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio12 = GUICtrlCreateRadio("Client", 20, 80, 80)

;Radio Button
GUICtrlCreateGroup("Client Verbose:", 200, 40, 100, 85)
$Radio21 = GUICtrlCreateRadio("Radio 1", 210, 60, 80)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio22 = GUICtrlCreateRadio("Radio 2", 210, 80, 80)

$Save = GUICtrlCreateButton("Save", 16, 145, 79, 25)

GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
    If $msg = $Save Then
        If GUICtrlRead($Radio11) = $GUI_CHECKED Then    ; Server is selected
            If GUICtrlRead($Radio21) = $GUI_CHECKED Then 
                MsgBox(0,"","Server and Radio1 selected")
            Else
                MsgBox(0,"","Server and Radio2 selected")
            EndIf
        EndIf
        If GUICtrlRead($Radio12) = $GUI_CHECKED Then    ; Client is selected
            If GUICtrlRead($Radio21) = $GUI_CHECKED Then 
                MsgBox(0,"","Client and Radio1 selected")
            Else
                MsgBox(0,"","Client and Radio2 selected")
            EndIf
        EndIf
    EndIf
WEnd

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
shay

I would do it this way:...

thanks man

this looks great

i`ll try imbeded this with my code.


"If the facts don't fit the theory, change the facts." Albert Einstein

Share this post


Link to post
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
Sign in to follow this  

×