Sign in to follow this  
Followers 0
ioctl

Disable checkbox

3 posts in this topic

I want to disable one treeviewitem , eg. checkbox[2] "calc" , but i cant.

Any ideas?

#include <GuiConstants.au3>

; GUI

GUICreate("Test -  ATK",530,400,-1,-1,BitOr($WS_MINIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))

GuiSetIcon(@SystemDir & "\mobsync.exe", 0)

;Buttons

$Test = GuiCtrlCreateButton("Test Selected", 415, 210, 100, 20)

$Button_Checkall = GuiCtrlCreateButton("Check All", 415, 260, 100, 20)

$Button_Clearall = GuiCtrlCreateButton("Clear All", 415, 285, 100, 20)

$Settings = GUICtrlCreateButton ("Settings", 415, 235, 100, 20)

$Exit = GUICtrlCreateButton ("Exit",  415, 310, 100, 20)

Dim $Icon[39],$Checkbox[39],$Label[39],$Installs[39]

$Icon[0] = 38

$Checkbox[0] = 38

$Label[0] = 38

$Installs[0] = 38

;INSTALLS

$Installs[1]      = "mspaint.exe"

$Installs[2]    = "calc.exe"

$Installs[3]          = "notepad.exe"

$Installs[4]          = "cmd.exe"

$maingroup = GUICtrlCreateGroup ("Select your mode",5,10,180,195)

$maintree = GUICtrlCreateTreeView (15,30,160,165,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)

$treeItem1 = GuiCtrlCreateTreeViewItem("Test1", $maintree)

$treeItem2 = GuiCtrlCreateTreeViewItem("Test2", $maintree)

$treeItem3 = GuiCtrlCreateTreeViewItem("Test3", $maintree)

$OPEN_PROGRAMS = GuiCtrlCreateTreeViewItem("Programs1", $treeItem1)

$OPEN_WEP64 = GuiCtrlCreateTreeViewItem("Programs2", $treeItem1)

$OPEN_WEP128 = GuiCtrlCreateTreeViewItem("Programs3", $treeItem1)

;EMPTY BOX

$EMPTY_GROUP = GUICtrlCreateGroup ("",198,10,328,195)

$EMPTY_TREE = GUICtrlCreateTreeView (208,30,310,165,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)

;PROGRAMS1

$PROGRAMS_GROUP = GUICtrlCreateGroup ("Programs1",198,10,328,195)

GUICtrlSetState (-1,$GUI_HIDE)

$PROGRAMS_TREE = GUICtrlCreateTreeView (208,30,310,165,BitOr($TVS_HASBUTTONS,$TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)

GUICtrlSetState (-1,$GUI_HIDE)

$Checkbox[1] = GUICtrlCreateTreeViewItem("MsPaint",$PROGRAMS_TREE)

$Checkbox[2] = GUICtrlCreateTreeViewItem ("Calc",$PROGRAMS_TREE)

$Checkbox[3] = GUICtrlCreateTreeViewItem ("Notepad",$PROGRAMS_TREE)

$Checkbox[4] = GUICtrlCreateTreeViewItem ("Command",$PROGRAMS_TREE)

GUICtrlSetState($Checkbox[2], $GUI_DISABLE)  ;  <<-----------------------------------------------------------------------

; GUI MESSAGE LOOP

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

 

Case $msg = $GUI_EVENT_CLOSE

        ExitLoop 

 

Case $msg = $Exit

ExitLoop

 

Case $msg = $treeItem1

GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE)

GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE)

GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW)

GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW)

Case $msg = $OPEN_PROGRAMS

GUIctrlSetState ($EMPTY_GROUP,$GUI_HIDE)

GUIctrlSetState ($EMPTY_TREE,$GUI_HIDE)

GUIctrlSetState ($PROGRAMS_GROUP,$GUI_SHOW)

GUIctrlSetState ($PROGRAMS_TREE,$GUI_SHOW)

Case $msg = $treeItem2

GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE)

GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE)

GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW)

GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW)

Case $msg = $treeItem3

GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE)

GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE)

GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW)

GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW)

; CHECK ALL BOXES 

 

Case $msg = $Button_Checkall

GUICtrlSetState($Checkbox[1], $GUI_CHECKED)

GUICtrlSetState($Checkbox[2], $GUI_CHECKED)

GUICtrlSetState($Checkbox[3], $GUI_CHECKED)

GUICtrlSetState($Checkbox[4], $GUI_CHECKED)

; CLEAR ALL BOXES

Case $msg = $Button_Clearall

GUICtrlSetState($Checkbox[1], $GUI_UNCHECKED)

GUICtrlSetState($Checkbox[2], $GUI_UNCHECKED)

GUICtrlSetState($Checkbox[3], $GUI_UNCHECKED)

GUICtrlSetState($Checkbox[4], $GUI_UNCHECKED)

Case $msg = $Test

          for $i = 1 to $CheckBox[0]

              If (GUICtrlRead($CheckBox[$i]) == $GUI_CHECKED) Then RunWait($Installs[$i])

    Next

   

    Case Else

 

EndSelect

WEnd

Exit

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

this worked

GUICtrlDelete($Checkbox[2])

so... maybe an if statement to control the delete???

hope it helps

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Yes valuater , thats nice. I will use it if i dont find a way to disable the checkbox.

If possible i want the checkbox to exist but be disabled (gray).

Thanks

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