Recent

Author Topic: DoContextPopup is not called for TreeView on pressing CtxMenu-key  (Read 557 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2574
    • UVviewsoft
My text editor has class for Code-tree:
Code: Pascal  [Select][+][-]
  1.   TAppTreeView = class(TTreeView)
  2.   private
  3.     procedure UpdateBars; inline;
  4.   protected
  5.     procedure DoSelectionChanged; override;
  6.     procedure Resize; override;
  7.     procedure Collapse(Node: TTreeNode); override;
  8.     procedure Expand(Node: TTreeNode); override;
  9.     procedure CMChanged(var Message: TLMessage); message CM_CHANGED;
  10.     function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
  11.     procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override;
  12.     procedure DoEnter; override;
  13.     procedure DoExit; override;
  14.     {$ifdef windows}
  15.     procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
  16.     {$endif}
  17.   public
  18.     Container: TAppTreeContainer;
  19.     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  20.   end;
  21.  

Gtk2: when I focus code-tree and press MENU keyboard button (located on my HP hotebook between right Alt and right Ctrl), DoContextPopup is called.
Call stack

Quote
#0 TFMMAIN.INITPOPUPTREE(TFMMAIN($00007CC969CC30B0)) at formmain_updates_proc.inc:1721
#1 TFMMAIN.DOCODETREE_ONCONTEXTPOPUP(TFMMAIN($00007CC969CC30B0), TOBJECT($00007CC975C7BF10), TPOINT (-1; -1), False) at formmain.pas:7807
#2 TCONTROL.DOCONTEXTPOPUP(TCONTROL($00007CC975C7BF10), TPOINT (-1; -1), False) at control.inc:2070
#3 TAPPTREEVIEW.DOCONTEXTPOPUP(TAPPTREEVIEW($00007CC975C7BF10), TPOINT (-1; -1), False) at proc_scrollbars.pas:226
#4 TCONTROL.WMCONTEXTMENU(TCONTROL($00007CC975C7BF10), TLMCONTEXTMENU (123; 0; 536932944; -1; -1; TSMALLPOINT (-1; -1); 4294967295; 0)) at control.inc:2485
#5 TWINCONTROL.WMCONTEXTMENU(TWINCONTROL($00007CC975C7BF10), TLMCONTEXTMENU (123; 0; 536932944; -1; -1; TSMALLPOINT (-1; -1); 4294967295; 0)) at wincontrol.inc:8466
#6 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal+170 at :0
#7 TCONTROL.WNDPROC(TCONTROL($00007CC975C7BF10), TLMESSAGE (123; 0; 536932944; 4294967295; 0)) at control.inc:2304
#8 TWINCONTROL.WNDPROC(TWINCONTROL($00007CC975C7BF10), TLMESSAGE (123; 0; 536932944; 4294967295; 0)) at wincontrol.inc:5474
#9 DELIVERMESSAGE(TOBJECT($00007CC975C7BF10), 0) at lclmessageglue.pas:114
#10 DELIVERMESSAGE(POINTER($00007CC975C7BF10), 0) at gtk2proc.inc:3801
#11 GTK2POPUPMENUCB(PGTKWIDGET($000000002000F250), POINTER($00007CC975C7BF10)) at gtk2widgetset.inc:129
#12 libgtk-x11-2.0.so.0.2400:gtk_main_do_event+8194 at :0

Qt5/Qt6: when I press Menu again on focused code-tree, DoContextPopup is NOT called.

Do I need to make bugreport?
« Last Edit: May 23, 2025, 06:38:50 pm by AlexTP »

dsiders

  • Hero Member
  • *****
  • Posts: 1440
Re: DoContextPopup is not called for TreeView on pressing CtxMenu-key
« Reply #1 on: May 23, 2025, 08:11:03 pm »
My text editor has class for Code-tree:
Code: Pascal  [Select][+][-]
  1.   TAppTreeView = class(TTreeView)
  2.   private
  3.     procedure UpdateBars; inline;
  4.   protected
  5.     procedure DoSelectionChanged; override;
  6.     procedure Resize; override;
  7.     procedure Collapse(Node: TTreeNode); override;
  8.     procedure Expand(Node: TTreeNode); override;
  9.     procedure CMChanged(var Message: TLMessage); message CM_CHANGED;
  10.     function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
  11.     procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override;
  12.     procedure DoEnter; override;
  13.     procedure DoExit; override;
  14.     {$ifdef windows}
  15.     procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
  16.     {$endif}
  17.   public
  18.     Container: TAppTreeContainer;
  19.     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  20.   end;
  21.  

Gtk2: when I focus code-tree and press MENU keyboard button (located on my HP hotebook between right Alt and right Ctrl), DoContextPopup is called.
Call stack

Quote
#0 TFMMAIN.INITPOPUPTREE(TFMMAIN($00007CC969CC30B0)) at formmain_updates_proc.inc:1721
#1 TFMMAIN.DOCODETREE_ONCONTEXTPOPUP(TFMMAIN($00007CC969CC30B0), TOBJECT($00007CC975C7BF10), TPOINT (-1; -1), False) at formmain.pas:7807
#2 TCONTROL.DOCONTEXTPOPUP(TCONTROL($00007CC975C7BF10), TPOINT (-1; -1), False) at control.inc:2070
#3 TAPPTREEVIEW.DOCONTEXTPOPUP(TAPPTREEVIEW($00007CC975C7BF10), TPOINT (-1; -1), False) at proc_scrollbars.pas:226
#4 TCONTROL.WMCONTEXTMENU(TCONTROL($00007CC975C7BF10), TLMCONTEXTMENU (123; 0; 536932944; -1; -1; TSMALLPOINT (-1; -1); 4294967295; 0)) at control.inc:2485
#5 TWINCONTROL.WMCONTEXTMENU(TWINCONTROL($00007CC975C7BF10), TLMCONTEXTMENU (123; 0; 536932944; -1; -1; TSMALLPOINT (-1; -1); 4294967295; 0)) at wincontrol.inc:8466
#6 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal+170 at :0
#7 TCONTROL.WNDPROC(TCONTROL($00007CC975C7BF10), TLMESSAGE (123; 0; 536932944; 4294967295; 0)) at control.inc:2304
#8 TWINCONTROL.WNDPROC(TWINCONTROL($00007CC975C7BF10), TLMESSAGE (123; 0; 536932944; 4294967295; 0)) at wincontrol.inc:5474
#9 DELIVERMESSAGE(TOBJECT($00007CC975C7BF10), 0) at lclmessageglue.pas:114
#10 DELIVERMESSAGE(POINTER($00007CC975C7BF10), 0) at gtk2proc.inc:3801
#11 GTK2POPUPMENUCB(PGTKWIDGET($000000002000F250), POINTER($00007CC975C7BF10)) at gtk2widgetset.inc:129
#12 libgtk-x11-2.0.so.0.2400:gtk_main_do_event+8194 at :0

Qt5/Qt6: when I press Menu again on focused code-tree, DoContextPopup is NOT called.

Do I need to make bugreport?

Does your overridden KeyDown handle VK_APPS? Because the standard tree control does not.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

AlexTP

  • Hero Member
  • *****
  • Posts: 2574
    • UVviewsoft
Re: DoContextPopup is not called for TreeView on pressing CtxMenu-key
« Reply #2 on: May 23, 2025, 08:15:30 pm »
My KeyDown don't handle VK_ codes:
Code: Pascal  [Select][+][-]
  1. procedure TAppTreeView.KeyDown(var Key: Word; Shift: TShiftState);
  2. begin
  3.   inherited KeyDown(Key, Shift);
  4. end;
  5.  

 

TinyPortal © 2005-2018