[BUG] Right-click treeview
BlitzMax Forums/MaxGUI Module/[BUG] Right-click treeview
| ||
' createtreeview.bmx Import MaxGui.Drivers Strict Local window:TGadget=CreateWindow("My Window",50,50,240,240,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS) Local treeview:TGadget=CreateTreeView(5,5,ClientWidth(window)-10,ClientHeight(window)-10,window) SetGadgetLayout treeview, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED Local root:TGadget=TreeViewRoot(treeview) Local help:TGadget=AddTreeViewNode("Help",root) AddTreeViewNode "Topic 1",help AddTreeViewNode "Topic 2",help AddTreeViewNode "Topic 3",help Local projects:TGadget=AddTreeViewNode("Projects",root) AddTreeViewNode("Sub Project",AddTreeViewNode("Project 1",projects)) AddTreeViewNode("Project 2",projects) AddTreeViewNode("Project 3",projects) While WaitEvent() Print CurrentEvent.ToString() 'Right click node-> mods=EventX(), x=EventY() BUG Select EventID() Case EVENT_WINDOWCLOSE End End Select Wend if you right-click treeview node, EventY() is always 0. problem is in win32maxguiex.bmx (line 3928...3940): PostGuiEvent EVENT_GADGETMENU, 0, hittest[0], hittest[1], 0, node change to this: PostGuiEvent (EVENT_GADGETMENU, 0, 0, hittest[0], hittest[1], node) [EDIT] if treeview is empty then we never get EVENT_GADGETMENU event. to fix this use: If SendMessageW(_hwnd,TVM_HITTEST,0,Int Byte Ptr(hittest)) If hittest[3]=TVI_ROOT node=_root Else item[0]=TVIF_PARAM item[1]=hittest[3] SendMessageW _hwnd,TVM_GETITEMW,0,Int Byte Ptr(item) node=TWindowsTreeNode(HandleToObject(item[9])) EndIf 'PostGuiEvent EVENT_GADGETMENU, 0, hittest[0], hittest[1], 0, node PostGuiEvent (EVENT_GADGETMENU , 0 , 0 , hittest[0] , hittest[1] , node) 'EventExtra() returns treeviewnode under mouse Else PostGuiEvent (EVENT_GADGETMENU , 0 , 0 , hittest[0] , hittest[1] , Null) 'add this.. EndIf Last edited 2011 |