Jump to content

GUI input box disabled


lrstndm
 Share

Recommended Posts

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
Link to comment
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

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