LondonNDIB Posted December 15, 2005 Share Posted December 15, 2005 Gui still confuses me With treeview... say I have something like this: + Category 1 |_ Item 1 |_ Item 2 |_ Item 3 I know when the user presses the + it folds/expands the Category 1. Is there some way that the + can be a control with its own event? Basically, I have hundreds of "Category"s each with some unknown number of "Item"s and it takes too long to generate the entire treeview with them all. What I want to achieve is that WHEN the user presses +, it runs a function that determines what should be in there. At first glance, this doesn't seem possible because the + doesn't even exist unless the "Category" has at least one "item" in it. I suppose I can get around that with a dummy item that gets deleted after the + is pressed... hmm. But I don't even know how I would go about calling the function with the + press. Any ideas? Thanks! LD Link to comment Share on other sites More sharing options...
tonedeaf Posted December 15, 2005 Share Posted December 15, 2005 This is an interesting problem. I would also like to see how it can be done. Link to comment Share on other sites More sharing options...
ReFran Posted December 15, 2005 Share Posted December 15, 2005 (edited) Here an example from ..... (Valuater if I remember right) Execute it and it will show you every item you have clicked (also Parents). HTH, Reinhard #include <GUIConstants.au3> Dim $curlevel = 1 Dim $aTree = StringSplit(FileRead("Tree.dat", FileGetSize("Tree.dat")), @LF) GUICreate("title") $hTree = GUICtrlCreateTreeView(5, 5, 300, 200) Dim $ahDepth[100] $ahDepth[0] = $hTree For $i = 1 to $aTree[0] $line = StringStripCR($aTree[$i]) $markpos = StringInStr($line, "#") If $markpos <> $curlevel Then $curlevel = $markpos $ahDepth[$markpos] = GUICtrlCreateTreeViewItem(StringMid($line, $markpos+1), $ahDepth[$markpos-1]) Next GUISetState() While 1 $nMsg = GUIGetMsg() if $nMsg > $ahDepth[$markpos] - Ubound($aTree) + 1 then msgBox(0,"",$aTree[$nMsg-($ahDepth[$markpos] - Ubound($aTree)+1)]) EndIf If $nMsg = -3 Then Exit Wend Here the Tree.dat file for the TV example, which must be in the script dir. #Level 1.1 #Level 2.1 #Level 2.2 #Level 2.3 #Level 3.1 #Level 4.1 #Level 3.2 #Level 2.4 #Level 3.3 #Level 1.2 #Level 2.5 #Level 2.6 Edited December 15, 2005 by ReFran Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now