Jump to content

GUI Checkbox


Recommended Posts

I would like to make my GUI with two checkbox validate that there is only one checkbox check.

When the user check the second one and the first one is already checked I would like to uncheck the first one. Same on the opposite way

It does seem to works:

#include <GuiConstants.au3>

GUICreate("Test",300,300,20,20)

$fichier = GUICtrlCreateMenu ("Fichier")

$Quitter = GUICtrlCreateMenuitem("Quitter",$fichier)

GuiCtrlCreateTab(0, 0, 200, 150)

GuiCtrlCreateTabItem("Info")

GUICtrlCreateLabel("ID support :",10,30,80,20)

$InputID= GuiCtrlCreateInput("", 70, 30, 100, 20)

;GUICtrlCreateLabel("Location :",10,60,50,20)

$1a6 = GUICtrlCreateCheckbox ( "1 a 6", 10,60,50,20)

$7a12 = GUICtrlCreateCheckbox ( "7 a 12", 10,90,80,20)

GuiSetState()

$msg = 0

$check1= 0

$check2 = 0

While $msg <> $GUI_EVENT_CLOSE

sleep(50)

$valueCheck1a6 = GUICtrlRead ($1a6)

$valueCheck7a12 = GUICtrlRead ($7a12)

if $valueCheck1a6 = 1 then

GUISetState ($7a12,$GUI_UNCHECKED)

EndIf

if $valueCheck7a12 = 1 Then

GUISetState ($1a6,$GUI_UNCHECKED)

EndIf

Select

Case $msg = $Quitter

Exit

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

Func Start_Regroupement()

EndFunc

Exit

Can someone help me?

Link to comment
Share on other sites

#include <GuiConstants.au3>
GUICreate("Test", 300, 300, 20, 20)
$fichier = GUICtrlCreateMenu("Fichier")
$Quitter = GUICtrlCreateMenuitem("Quitter", $fichier)
GUICtrlCreateTab(0, 0, 200, 150)
GUICtrlCreateTabItem("Info")
GUICtrlCreateLabel("ID support :", 10, 30, 80, 20)
$InputID = GUICtrlCreateInput("", 70, 30, 100, 20)
;GUICtrlCreateLabel("Location :",10,60,50,20)
$1a6 = GUICtrlCreateCheckbox("1 a 6", 10, 60, 50, 20)
$7a12 = GUICtrlCreateCheckbox("7 a 12", 10, 90, 80, 20)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Quitter
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $1a6
            If BitAND(GUICtrlRead($1a6), $GUI_CHECKED) Then GUICtrlSetState($7a12, $GUI_UNCHECKED)
            
        Case $msg = $7a12
            If BitAND(GUICtrlRead($7a12), $GUI_CHECKED) Then GUICtrlSetState($1a6, $GUI_UNCHECKED)
    EndSelect
WEnd
Exit

Func Start_Regroupement()
    
EndFunc   ;==>Start_Regroupement

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Just a question...why don't you use radio buttons for this?

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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