Sign in to follow this  
Followers 0
lrstndm

GUI input box disabled

3 posts in this topic

Hee Guys,

I have an simple gui with an checkbox (code below)

What i want is that if i check the checkbox the input box have to be disabled.

and when i uncheck it, the input box have to be enabled.

How do i do this?

Thanks in advance

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Main = GUICreate("Form1", 282, 103, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 32, 24, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 97, 48, 55, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 160, 26, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
    
    EndSelect
WEnd

Share this post


Link to post
Share on other sites



#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Main = GUICreate("Form1", 282, 103, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 32, 24, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 97, 48, 55, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 160, 26, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Checkbox1
            If IsChecked($Checkbox1) Then
                GUICtrlSetState($Input1, $GUI_DISABLE)
            Else
                GUICtrlSetState($Input1, $GUI_ENABLE)
            EndIf
    EndSelect
WEnd

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

Share this post


Link to post
Share on other sites

Thanks thats exactly what i wanted!!!

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