Jump to content

Recommended Posts

I used the example for _GUICtrlTreeView_ClickItem and the debug shows single and double clicks as working. Then i removed all the stuff i don't want from the example. I also removed the WM_NOTIFY function or my example wouldn't work. Now it runs but my example only works with single click (,2 is enabled). Something to note is i had to put the full path to WM_NOTIFY.au3 or it came up with an error. Here is my script

 

#include <C:\Program Files\AutoIt3\Examples\Helpfile\Extras\WM_NOTIFY.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>

Global $g_idTreeView

Example()

Func Example()
        GUICreate("TreeView Click Item", 400, 300)

        Local $iStyle = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)
        $g_idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)

        Local $A      = GUICtrlCreateTreeViewItem("A",   $g_idTreeView)
        Local $A01    = GUICtrlCreateTreeViewItem("A01", $A)
        Local $A02    = GUICtrlCreateTreeViewItem("A02", $A)

        Local $B      = GUICtrlCreateTreeViewItem("B",   $g_idTreeView)
        Local $B01    = GUICtrlCreateTreeViewItem("B01", $B)
        Local $B02    = GUICtrlCreateTreeViewItem("B02", $B)

        GUISetState(@SW_SHOW)

        Local $iMsg

        _WM_NOTIFY_Register()
        _GUICtrlTreeView_BeginUpdate($g_idTreeView)
        _GUICtrlTreeView_EndUpdate($g_idTreeView)
        _GUICtrlTreeView_ClickItem($A01, "left", False, 2)

            While 1

            $iMsg = GUIGetMsg()

        If $iMsg = $A01 Then
            WinActivate ("Untitled - Notepad")
            Send ("A{ENTER}")
        EndIf

        If $iMsg = $GUI_EVENT_CLOSE Then ExitLoop

        WEnd

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example

 

Link to post
Share on other sites

_WM_NOTIFY_Register() will not create a WM_NOTIFY function.  You need to provide one in order for it to work.  In fact do not use _WM_NOTIFY_Register(), it is useless, just register your own function with GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY).  Note that the function is not in double-quotes, it is a better way to reference a function.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...