Jump to content

GUIGetMsg'ing of a TreeView?


AzKay
 Share

Recommended Posts

#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- #
Link to comment
Share on other sites

#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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...