Jump to content

Help with using Radio button in GUI


shay
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...