Pottery Posted March 3, 2010 Share Posted March 3, 2010 I used the search bar but didn't really find anything, how do I link text in treeview to functions? For example, the treeview: Sample 1 Sample 2 Sample 3 Sample 4 Sample 5 And I want sample 3 to be linked to _ExampleFunction, how would I go about doing that? Link to comment Share on other sites More sharing options...
JRowe Posted March 3, 2010 Share Posted March 3, 2010 Linked how? You want it to launch _ExampleFunction() when it's clicked? #Include <GuiTreeView.au3> $clickedItem = _GUICtrlTreeView_HitTestItem($hWnd, $iX, $iY) $hWnd is the handle to your treeview, $iX is the X position of the mouse cursor, $iY is the y position. You'll need to watch for clicks, for example, GUIRegisterMsg($WM_LBUTTONDOWN, "SomethingWasClicked") Then register a function that checks to see what was clicked, then if it was item 3, launch _ExampleFunction(). Func SomethingWasClicked() $clickedItem = _GUICtrlTreeView_HitTestItem($hWnd, $iX, $iY) If $clickedItem = $treeItem3 Then _ExampleFunction() EndIf EndFunc You'll need to work this into your program and fill in the blanks, but that's one way of linking items. There are probably easier methods on the forum. Search for "_GUICtrlTreeView_HitTestItem"in the Examples and GUI help forums. Good luck! [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] 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