MikelSevrel Posted March 4, 2006 Share Posted March 4, 2006 Is it possible to be able to return the text of a TreeView Item by clicking on it? And if so, how? Hopefully that summed it up. Coming soon.... Link to comment Share on other sites More sharing options...
neogia Posted March 4, 2006 Share Posted March 4, 2006 Is it possible to be able to return the text of a TreeView Item by clicking on it? And if so, how? Hopefully that summed it up. In your GUI Message loop, you could throw in: If GUICtrlRead($treeview) == $myTreeViewID Then myTVFunc() EndIf ... Hopefully that'll get you started. [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 5, 2006 Author Share Posted March 5, 2006 (edited) No. I need to get the text from the treeview item when I click on it. The TreeView text is variable, and I need to get that variable. So say this is how the treeview looks: Main ->Option ->Option2 ->SubOption1 ->SubOption2 ->SubSubOption1 ->Option3 I need to get the text "SubSubOption1" when I click on it. I've seen this functionality in AutoIt Explorer, but I can't make heads or tails of the code. btw: Thanks for trying. Edited March 5, 2006 by MikelSevrel Coming soon.... Link to comment Share on other sites More sharing options...
neogia Posted March 5, 2006 Share Posted March 5, 2006 No. I need to get the text from the treeview item when I click on it. The TreeView text is variable, and I need to get that variable. So say this is how the treeview looks: Main ->Option ->Option2 ->SubOption1 ->SubOption2 ->SubSubOption1 ->Option3 I need to get the text "SubSubOption1" when I click on it. I've seen this functionality in AutoIt Explorer, but I can't make heads or tails of the code. btw: Thanks for trying. So to be clear, this is not an AutoIt GUI, but rather some other program's GUI? [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 5, 2006 Author Share Posted March 5, 2006 No, it's AutoIt. But the problem is I cannot define the individual treeitems because they are created from files, and and are not constants. Coming soon.... Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 5, 2006 Author Share Posted March 5, 2006 (edited) i think I'm on the right track, but I'm unsure of the syntax. Coudl anyone take a look at this: Case $msg = $GUI_EVENT_PRIMARYDOWN $a = GUIGetCursorInfo() $rect = DllStructCreate("long;int;int;int") $ctrl_hwnd = DLLCall("user32.dll","hwnd","GetDlgItemText","hwnd",GUICtrlGetHandle($TreeView1),"int",$a[4],"str",DllStructGetPtr($rect)) $l = DllStructGetData($rect,1) MsgBox(0,$TreeView1,$l) Edited March 5, 2006 by MikelSevrel Coming soon.... Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 5, 2006 Author Share Posted March 5, 2006 Anyone even know if a DLLCall is the right way to go? Coming soon.... Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 6, 2006 Author Share Posted March 6, 2006 You can get rid of this, though it would certainly be a nice function to have. Coming soon.... Link to comment Share on other sites More sharing options...
neogia Posted March 6, 2006 Share Posted March 6, 2006 Well, if you're reading in the information, then you can store the pointers in an array, like so: Dim $items[$MAX_ITEMS][2] For $i = 0 To $MAX_ITEMS $items[$i][0] = FileReadLine($file);Reading what's put in the treeview $items[$i][1] = GUICtrlCreateTreeViewItem($items[$i][0], $parentTree) Next While 1 If GUIGetMsg() == $GUI_EVENT_CLOSE Then ExitLoop EndIf If GUICtrlRead($treeview) <> 0 Then For $c = 0 To $MAX_ITEMS If GUICtrlRead($treeview) == $items[$c][1] Then MsgBox(0, "", "You clicked on " & $items[$c][0]) EndIf Next EndIf WEnd [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia 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