Jump to content
Sign in to follow this  
HiSoftDev

Disabled Check Box

Recommended Posts

HiSoftDev

script will read a reg key and if it found they key there then it will disable the checkbox.

can anyone tell me how to disable checkbox?

thanks.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate(\"Test\", 133, 105, 254, 220)
$C1 = GUICtrlCreateCheckbox(\"Choice 1\", 32, 16, 97, 17)
$C2 = GUICtrlCreateCheckbox(\"Choice 2\", 32, 41, 97, 15)
$B1 = GUICtrlCreateButton(\"Button1\", 24, 72, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $C1
            GUICtrlRead($C1) = 
            ; another code
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
HiSoftDev

i want to disable check box only (Not the text with it) can id do it?


Share this post


Link to post
Share on other sites
bluelamp

i don´t think so

Share this post


Link to post
Share on other sites
dbzfanatic

You could change the background to grey/white/your GUI's BG color after it's disabled to make it seem like the text is still active and even if it's disabled you should still be able to change the text within your code so that should be all you need.

Share this post


Link to post
Share on other sites
ChromeFan

you can create Labels with your checkBox and remove the text with CheckBox.


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites
Zedna

#include <ButtonConstants.au3>#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate("\Test\", 133, 105, 254, 220)
$C1 = GUICtrlCreateCheckbox("\Choice 1\", 32, 16, 97, 17)
$C2 = GUICtrlCreateCheckbox("\Choice 2\", 32, 41, 97, 15)
$B1 = GUICtrlCreateButton("\Button1\", 24, 72, 75, 25, 0)

$reg_value = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Your Company Name\Your software Name", "YourValue")
If @error Then GUICtrlSetState($C1, $GUI_DISABLE)

GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $B1
            If IsChecked($C1) Then ; ...
            ; another code
    EndSwitch
WEnd

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

Share this post


Link to post
Share on other sites
rasim

i want to disable check box only (Not the text with it) can id do it?

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

$GUI = GUICreate("Test", 133, 105, 254, 220)

GUICtrlCreateLabel("Choice 1", 50, 16, 50, 16)
$C1 = GUICtrlCreateCheckbox("", 32, 16, 15, 16)

GUICtrlCreateLabel("Choice 1", 50, 41, 50, 16)
$C2 = GUICtrlCreateCheckbox("Choice 2", 32, 41, 15, 16)

$B1 = GUICtrlCreateButton("Disable", 24, 72, 75, 25, 0)

GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $B1
            If GUICtrlRead($B1) = "Disable" Then
                GUICtrlSetState($C1, $GUI_DISABLE)
                GUICtrlSetState($C2, $GUI_DISABLE)
                GUICtrlSetData($B1, "Enable")
            Else
                GUICtrlSetState($C1, $GUI_ENABLE)
                GUICtrlSetState($C2, $GUI_ENABLE)
                GUICtrlSetData($B1, "Disable")
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
HiSoftDev

@ rasim

hi friend, this is 3rd time you helped me. thanks a lot for your help and i will never forget it. thanks once again.


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  

×