Sign in to follow this  
Followers 0
stg68

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

3 posts in this topic

Basically, I want to show or hide GuiCtrlCreateInput depending on the event what end user selects. In my case it is a checkbox check/uncheck.

Thank you for your help!

Share this post


Link to post
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.

Share this post


Link to post
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!

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  
Followers 0