Jump to content
Sign in to follow this  
AzKay

GUIGetMsg'ing of a TreeView?

Recommended Posts

AzKay

#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GUITreeView.au3>
#include <GUIListBox.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 682, 294, 193, 115)
$TreeView1 = GUICtrlCreateTreeView(8, 9, 225, 276)
GUICtrlCreateTreeViewItem("Test", $TreeView1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $TreeView1
            MsgBox(0, "", "")
    EndSwitch
    Sleep(10)
WEnd

Any way of getting that working?

eg; MsgBox() when the treeview is clicked?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
Zedna

#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GUITreeView.au3>
#include <GUIListBox.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 682, 294, 193, 115)
$TreeView1 = GUICtrlCreateTreeView(8, 9, 225, 276)
GUICtrlCreateTreeViewItem("Test", $TreeView1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func onclick()
    MsgBox(0, "Info", "Click")
EndFunc

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tagNMHDR, $event
        If $wParam = $TreeView1 Then
        $tagNMHDR = DllStructCreate("int;int;int", $lParam)
        If @error Then Return
        $event = DllStructGetData($tagNMHDR, 3)
                If $event = $NM_CLICK Then onclick()
    EndIf
EndFunc

Share this post


Link to post
Share on other sites
AzKay

Thanks, Though, Thatll call the function whenever anything within the treeview control is clicked.

But I guess it cant be helped.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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  

×