Jump to content

How to show/hide GuiCtrlCreateInput on GuiCreate according to checkbox check/uncheck.


stg68
 Share

Recommended Posts

#include <GUIConstantsEx.au3>

Dim $hGUI
Dim $Checkbox
Dim $Input

$hGUI = GUICreate('Test', 200, 100)
$Checkbox = GUICtrlCreateCheckbox('Show', 20, 20)
$Input = GUICtrlCreateInput('', 20, 60, 160,23)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()
While 1
    Switch GUIGetMsg()
        Case $Checkbox
            If GUICtrlRead($Checkbox) = $GUI_CHECKED Then
                GUICtrlSetState($Input, $GUI_SHOW)
                GUICtrlSetData($Checkbox, 'Hide')
            Else
                GUICtrlSetState($Input, $GUI_HIDE)
                GUICtrlSetData($Checkbox, 'Show')
            EndIf
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
GUIDelete()
Exit

The help file is your friend :) you could save about an half hour if you would take the effort.

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

Dim $hGUI
Dim $Checkbox
Dim $Input

$hGUI = GUICreate('Test', 200, 100)
$Checkbox = GUICtrlCreateCheckbox('Show', 20, 20)
$Input = GUICtrlCreateInput('', 20, 60, 160,23)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()
While 1
    Switch GUIGetMsg()
        Case $Checkbox
            If GUICtrlRead($Checkbox) = $GUI_CHECKED Then
                GUICtrlSetState($Input, $GUI_SHOW)
                GUICtrlSetData($Checkbox, 'Hide')
            Else
                GUICtrlSetState($Input, $GUI_HIDE)
                GUICtrlSetData($Checkbox, 'Show')
            EndIf
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
GUIDelete()
Exit

The help file is your friend :) you could save about an half hour if you would take the effort.

Thank you very much for your help!
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...