Jump to content

CheckBox problem


Info
 Share

Recommended Posts

#include <GUIConstants.au3>

GUICreate("O_O", 170, 174, 370, 235, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$Input1 = GUICtrlCreateInput ( ">_<", 8, 8, 150, 20, $ES_READONLY)
$CheckBox = GUICtrlCreateCheckbox ( "CheckBox", 5, 42.5, 130, 15)
GUISetState (@SW_SHOW)

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

I want it to remove the "$ES_READONLY" from the Input when I check the CheckBox...

HOW?

THANKS

Edited by Info
Link to comment
Share on other sites

Try this

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
GUICreate("O_O", 170, 174, 370, 235, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$Input1 = GUICtrlCreateInput ( ">_<", 8, 8, 150, 20)
GUICtrlSetState(-1, $GUI_DISABLE)

$CheckBox = GUICtrlCreateCheckbox ( "CheckBox", 5, 42.5, 130, 15)
GUICtrlSetOnEvent(-1, "Chk")

GUISetOnEvent($GUI_EVENT_CLOSE, "FormClose")
GUISetState (@SW_SHOW)

While 1
    Sleep(1000)
WEnd

Func Chk()
    If BitAND(GUICtrlRead($CheckBox), $GUI_CHECKED) Then 
        GUICtrlSetState($Input1, $GUI_ENABLE)
    Else
        GUICtrlSetState($Input1, $GUI_DISABLE)
    EndIf
EndFunc

Func FormClose()
    Exit
EndFunc
Link to comment
Share on other sites

Hi,

#include <GUIConstants.au3>

GUICreate(":-)", 170, 174, 370, 235, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$Input1 = GUICtrlCreateInput ( ">_<", 8, 8, 150, 20, $ES_READONLY)
$CheckBox = GUICtrlCreateCheckbox ( "CheckBox", 5, 42.5, 130, 15)
GUISetState (@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $CheckBox
        If BitAnd(GUICtrlRead($CheckBox), $GUI_CHECKED) Then
            GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT)
            GUICtrlSetState($Input1, $GUI_FOCUS)
        Else
            GUICtrlSetStyle($Input1, $ES_READONLY)
        EndIf   
    EndSwitch
WEnd

Cheers

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