Jump to content

Gui Help


Vos
 Share

Recommended Posts

I am writing on here because i need some help to find out what i need to search for or if someone knows of an example i could go off. what i am trying to do i feel is very simple but don't know what its called. i have created a simple Gui that has 1 input box and 6 check boxes. all i want to do is have 5 of the check boxes not visible with the 6th default checked (which i know how to do). If someone were to un-check that box the other 5 become visible. How to a make them visible on action? or what is it called so i can know what to search for? or does anyone have an example gui where they do this? here is my gui

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 261, 253, 192, 124)

$Row = GUICtrlCreateInput("Input", 32, 16, 177, 21)

$Checkbox1 = GUICtrlCreateCheckbox("Default Set", 32, 48, 97, 17)

GUICtrlSetState(-1, $GUI_CHECKED)

$Checkbox2 = GUICtrlCreateCheckbox("2", 32, 144, 97, 17)

$Checkbox3 = GUICtrlCreateCheckbox("3", 32, 72, 121, 17)

$Checkbox4 = GUICtrlCreateCheckbox("4", 32, 96, 121, 17)

$Checkbox5 = GUICtrlCreateCheckbox("5", 32, 120, 225, 17)

$Checkbox9 = GUICtrlCreateCheckbox("6", 32, 168, 129, 17)

$Button1 = GUICtrlCreateButton("Ok", 24, 200, 75, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Cancel", 128, 200, 75, 25, $WS_GROUP)

GUISetState(@SW_SHOW)

Link to comment
Share on other sites

  • Developers

Just do a GuiMsg() check for the $Checkbox9 being clicked.

Check if it is Checked or not GUICtrlRead($Checkbox9) = $GUI_CHECKED and use GUICtrlSetState() to Enable/Disable/Hide/Show the other checkboxes.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Maybe this?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 261, 253, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "__MyExit")
$Row = GUICtrlCreateInput("Input", 32, 16, 177, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Default Set", 32, 48, 97, 17)
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetOnEvent($Checkbox1, "__ChangeState")
$Checkbox2 = GUICtrlCreateCheckbox("2", 32, 144, 97, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$Checkbox3 = GUICtrlCreateCheckbox("3", 32, 72, 121, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$Checkbox4 = GUICtrlCreateCheckbox("4", 32, 96, 121, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$Checkbox5 = GUICtrlCreateCheckbox("5", 32, 120, 225, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$Checkbox9 = GUICtrlCreateCheckbox("6", 32, 168, 129, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$Button1 = GUICtrlCreateButton("Ok", 24, 200, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Cancel", 128, 200, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "__MyExit")
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    ;If GUICtrlGetState($Checkbox1) = $GUI_UNCHECKED Then __ChangeState()
WEnd

Func __ChangeState()
    If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
        GUICtrlSetState($Checkbox2, $GUI_SHOW)
        GUICtrlSetState($Checkbox3, $GUI_SHOW)
        GUICtrlSetState($Checkbox4, $GUI_SHOW)
        GUICtrlSetState($Checkbox5, $GUI_SHOW)
        GUICtrlSetState($Checkbox9, $GUI_SHOW)
    ElseIf GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
        GUICtrlSetState($Checkbox2, $GUI_HIDE)
        GUICtrlSetState($Checkbox3, $GUI_HIDE)
        GUICtrlSetState($Checkbox4, $GUI_HIDE)
        GUICtrlSetState($Checkbox5, $GUI_HIDE)
        GUICtrlSetState($Checkbox9, $GUI_HIDE)
    EndIf
EndFunc   ;==>__ChangeState

Func __MyExit()
    Exit
EndFunc   ;==>__MyExit
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...