File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1520,6 +1520,7 @@ procedure FixVT(VT: TVirtualStringTree; IsResultGrid: Boolean=False);
15201520 VT.OnStartOperation := Mainform.AnyGridStartOperation;
15211521 VT.OnEndOperation := Mainform.AnyGridEndOperation;
15221522 VT.BorderStyle := bsNone; // Cosmetic
1523+ VT.OnContextPopup := MainForm.AnyGridContextPopup;
15231524end ;
15241525
15251526
Original file line number Diff line number Diff line change @@ -2136,6 +2136,7 @@ object MainForm: TMainForm
21362136 OnBeforePaint = ListTablesBeforePaint
21372137 OnChange = ListTablesChange
21382138 OnCompareNodes = AnyGridCompareNodes
2139+ OnContextPopup = AnyGridContextPopup
21392140 OnDblClick = ListTablesDblClick
21402141 OnEditing = ListTablesEditing
21412142 OnGetText = ListTablesGetText
Original file line number Diff line number Diff line change @@ -837,6 +837,8 @@ TMainForm = class(TExtForm)
837837 procedure actDataEditWithoutLookupExecute(Sender: TObject);
838838 procedure actNextTabExecute(Sender: TObject);
839839 procedure actPreviousTabExecute(Sender: TObject);
840+ procedure AnyGridContextPopup(Sender: TObject; MousePos: TPoint;
841+ var Handled: Boolean);
840842 procedure DataGridContextPopup(Sender: TObject; MousePos: TPoint;
841843 var Handled: Boolean);
842844 procedure FormActivate(Sender: TObject);
@@ -4538,6 +4540,25 @@ procedure TMainForm.actPreviousTabExecute(Sender: TObject);
45384540 PageControlMain.SelectNextPage(False);
45394541end;
45404542
4543+ procedure TMainForm.AnyGridContextPopup(Sender: TObject; MousePos: TPoint;
4544+ var Handled: Boolean);
4545+ var
4546+ Tree: TLazVirtualStringTree;
4547+ P: TPoint;
4548+ begin
4549+ Tree := Sender as TLazVirtualStringTree;
4550+ if Tree.Header.PopupMenu = nil then
4551+ Exit;
4552+ if Tree.Header.InHeader(MousePos) then begin
4553+ // Issue #2271:
4554+ // We get here through a wrong event path, when mouse right-clicks the header area
4555+ Tree.Header.PopupMenu.PopupComponent := Tree;
4556+ P := Tree.ClientToScreen(MousePos);
4557+ Tree.Header.PopupMenu.Popup(P.X, P.Y); // This is the actually wanted header context menu
4558+ Handled := True;
4559+ end;
4560+ end;
4561+
45414562procedure TMainForm.DataGridContextPopup(Sender: TObject; MousePos: TPoint;
45424563 var Handled: Boolean);
45434564var
You can’t perform that action at this time.
0 commit comments