Created
June 15, 2014 13:00
-
-
Save maestrith/b2ccece09b8ca83b1a89 to your computer and use it in GitHub Desktop.
Posted using AHK Studio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance,Force | |
Gui,Add,TreeView,w200 h600 Checked AltSubmit gcheck | |
Loop,4 | |
{ | |
top:=TV_Add("Item " A_Index) | |
loop,4 | |
child:=TV_Add("Item " A_Index,top,"Vis") | |
loop,4 | |
grandchild:=TV_Add("Item " A_Index,child,"Vis") | |
loop,4 | |
TV_Add("Item " A_Index,grandchild,"Vis") | |
} | |
change: | |
check:=[] | |
while,next:=TV_GetNext(next,"F") | |
check.value[next]:=TV_Get(next,"C") | |
TV_Modify(TV_GetNext(0,"F"),"Select Vis Focus") | |
Gui,Show | |
Return | |
check: | |
if A_GuiEvent not in Normal,K | |
return | |
info:=A_GuiEvent="K"?TV_GetSelection():A_EventInfo,effected:=[] | |
if (check.value[info]!=(checked:=TV_Get(info,"C"))){ | |
if (checked){ ;check all above it | |
child:=top:=info | |
while,top:=TV_GetParent(top) | |
TV_Modify(top,"Check") | |
while,child:=TV_GetNext(child,"F"){ ;check all below it | |
if parent(info,child) | |
TV_Modify(child,"Check") | |
} | |
}Else{ | |
top:=info | |
while,child:=TV_GetNext(child,"F"){ ;uncheck all below it | |
if parent(info,child) | |
TV_Modify(child,"-Check") | |
} | |
while,top:=TV_GetParent(top){ ;Check All and see if there are any left | |
next:=top | |
while,next:=TV_GetNext(next,"F"){ | |
if parent(top,next){ | |
if TV_Get(next,"C") | |
checked:=TV_Get(next,"C") | |
} | |
} | |
if !checked | |
TV_Modify(top,"-Check") ;if not uncheck the parent | |
checked:=0 | |
} | |
} | |
next:=0 | |
while,next:=TV_GetNext(next,"F") | |
Check.value[next]:=TV_Get(next,"C") | |
} | |
return | |
Parent(top,check){ | |
check1:=check | |
if (top=check) | |
return | |
while,check1:=TV_GetParent(check1) | |
if (top=check1) | |
return check1 | |
return | |
} | |
Return | |
GuiClose: | |
GuiEscape: | |
ExitApp | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment