Sign in to follow this  
Followers 0
Lemon.fr

Help To Capture Treeviewitems Events (clicks & Dblclicks)

7 posts in this topic

Hi,

I really need help about this, from the Help files it seems the TreeView Items clicks are captured with GUIGetMsg, but im working with a big treeview...

; Need help to capture events on TreeviewItems as Click,DblClick in a better way
; includes
#include <GUIConstants.au3>
;
$myGui=GUICreate("TVI click & DblClick ?",300,400,-1,-1)
$myTreeView=GUICtrlCreateTreeView(10,10,280,350)
; few parent items, Control IDs stored in array
Dim $MainItem[3]
$MainItem[0]=GUICtrlCreateTreeViewItem("Item1",$myTreeView)
$MainItem[1]=GUICtrlCreateTreeViewItem("Item2",$myTreeView)
$MainItem[2]=GUICtrlCreateTreeViewItem("Item3",$myTreeView)
; lots of subitems, Control IDs stored in array
$MaxSubItems=300
Dim $SubItems[$MaxSubItems]

For $i=0 to $MaxSubItems-1
    $r=Random(0,2,1); from 0 to 2 and return an Int
    $SubItems[$i]=GUICtrlCreateTreeViewItem("SubItem "&$i,$MainItem[$r])
Next
GUISetState(@SW_SHOW,$myGui)

; Main event loop
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
; Now i want to capture a click on a subitem...
    For $i=0 to $MaxSubItems-1
        If $msg=$SubItems[$i] Then ItemClicked($i)
    Next
Wend

Func ItemClicked($ItemNumber)
    MsgBox (0,"","SubItem "&$ItemNumber&" clicked !")
EndFunc

If $MaxSubItems=300 then it's fast enought to capture the event, but try $MaxSubItems=3000 (or more if you have a faster cpu than mine),

Sure, a treeview with 3000 subitems is a rare thing but i would have an alternative way to capture the selected subitems (because i may have also more controls in my gui) and i need it to return the CtrlID of the clicked subitems, i will also need to capture a doubleClick on a Subitem.

Any ideas ?

Thx.

ps: Nice community by the way :think:

Share this post


Link to post
Share on other sites



In link from Valuater search function GUIRegisterMsg(), it's core of solution ...

Thanks guys, yes i knew i need to use these Win32 API messages thingy...im really a noob at it but i would learn it because it looks really intersting. :think:

Where could i find tutorials and desciptions of API messages ? (googled on MS website with no result)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks guys, yes i knew i need to use these Win32 API messages thingy...im really a noob at it but i would learn it because it looks really intersting. :think:

Where could i find tutorials and desciptions of API messages ? (googled on MS website with no result)

See my post: Win32 API documentation

EDIT:

And at MSDN is online documentation for all that Win32 API stuff

type name of desired API function into Search edit for detailed info...

Edited by Zedna

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

See my post: Win32 API documentation

EDIT:

And at MSDN is online documentation for all that Win32 API stuff

type name of desired API function into Search edit for detailed info...

Yes, thanks :think:

After many search, i also found this:

http://www.microsoft.com/msdownload/platfo...FULLInstall.htm

Free download and you dont need Visual Studio install :)

Edit: if you install it, you will find in C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include

all the .h files with constants in, im gonna write my own includes with all needed constants, maybe someone did it, i dunno :(

Edited by Lemon.fr

Share this post


Link to post
Share on other sites

Yes, thanks :think:

After many search, i also found this:

http://www.microsoft.com/msdownload/platfo...FULLInstall.htm

Free download and you dont need Visual Studio install :)

Edit: if you install it, you will find in C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include

all the .h files with constants in, im gonna write my own includes with all needed constants, maybe someone did it, i dunno :(

One way to find out, when you find your constants, do a search for them like this: $Constant1+$Constant2+$Constant3, That will tell you if your doing all the work for practice or not ;)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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