Right click and context menu
Original Reporter info from Mantis: El Salvador
-
Reporter name:
Original Reporter info from Mantis: El Salvador
- Reporter name:
Description:
Under certain conditions, VTV can't open the context menu (popupmenu) by user's right click on a node. But if user right click on vtv's blank space, the context menu works.
Steps to reproduce:
1 Put a TVirtualStringTree and a popupmenu in form
2 Set these properties:
- RootNodeCount = any number (we need some nodes)
- DragType = dtVCL
- DragMode = dmAutomatic
- PopupMenu
- TreeOptions.SelectionOptions.toRightClickSelect = True
3 Try. If you right click on a node, vtv will select the node, but it will not open popupmenu. If you right click on a blank space, instead vtv will open the popupmenu
I upload a project sample. Try it.
Additional information:
The reason seems LCL's drag code (I don't a LCL expert, I can wrong, but for now I put this ticket in VirtualTree category). In fact, if we will disable automatic drag, the context menu will open. Every time.
For now, I use this workaround in VTV code to avoid drag when user right click, but it is not a solution:
@@ -21217,7 +21228,7 @@
// Drag'n drop initiation
// If we lost focus in the interim the button states would be cleared in WM_KILLFOCUS.
- if AutoDrag and IsAnyHit and (FStates * [tsLeftButtonDown, tsRightButtonDown, tsMiddleButtonDown] <> []) then
+ if AutoDrag and IsAnyHit and (FStates * [tsLeftButtonDown, tsMiddleButtonDown] <> []) then
BeginDrag(False);
end;
end;
Mantis conversion info:
- Mantis ID: 25910
- OS: Windows
- OS Build: Windows 7 64bit
- Platform: Intel
- Monitored by: » El Salvador (El Salvador)