diff --git a/source/main.dfm b/source/main.dfm index 7c9a3531..40290863 100644 --- a/source/main.dfm +++ b/source/main.dfm @@ -1273,7 +1273,6 @@ object MainForm: TMainForm LineStyle = lsSolid PopupMenu = popupDataGrid TabOrder = 2 - TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoTristateTracking, toAutoDeleteMovedNodes, toDisableAutoscrollOnFocus, toDisableAutoscrollOnEdit] TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toGridExtensions, toInitOnSave, toToggleOnDblClick, toWheelPanning] TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages, toAlwaysHideSelection] TreeOptions.SelectionOptions = [toExtendedFocus, toMultiSelect, toRightClickSelect] @@ -1433,13 +1432,12 @@ object MainForm: TMainForm LineStyle = lsSolid PopupMenu = popupResultGrid TabOrder = 1 - TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoTristateTracking, toAutoDeleteMovedNodes, toDisableAutoscrollOnFocus, toDisableAutoscrollOnEdit] TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toGridExtensions, toInitOnSave, toToggleOnDblClick, toWheelPanning] TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages, toAlwaysHideSelection] TreeOptions.SelectionOptions = [toExtendedFocus, toMultiSelect, toRightClickSelect] WantTabs = True OnBeforeCellPaint = GridBeforeCellPaint - OnFocusChanging = QueryGridFocusChanging + OnFocusChanged = QueryGridFocusChanged OnGetText = GridGetText OnPaintText = GridPaintText OnKeyDown = GridKeyDown diff --git a/source/main.pas b/source/main.pas index 16ef6d67..029aeca0 100644 --- a/source/main.pas +++ b/source/main.pas @@ -720,9 +720,7 @@ type procedure popupDataViewPopup(Sender: TObject); procedure menuViewDefaultClick(Sender: TObject); procedure menuViewSaveClick(Sender: TObject); - procedure QueryGridFocusChanging(Sender: TBaseVirtualTree; OldNode, - NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; - var Allowed: Boolean); + procedure QueryGridFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); procedure pnlQueryHelpersCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean); procedure pnlQueryMemoCanResize(Sender: TObject; var NewWidth, @@ -795,7 +793,6 @@ type function GetSelTableColumns: TDataset; function GetSelTableKeys: TDataset; procedure AutoCalcColWidths(Tree: TVirtualStringTree; PrevLayout: Widestrings.TWideStringlist = nil); - procedure FocusGridCol(Grid: TBaseVirtualTree; Column: TColumnIndex); public cancelling: Boolean; virtualDesktopName: string; @@ -7982,8 +7979,6 @@ begin Allowed := DataGridPostUpdateOrInsert(OldNode) else Allowed := True; - if Allowed and (OldColumn <> NewColumn) and (NewColumn <> -1) then - FocusGridCol(Sender, NewColumn); end; @@ -8735,34 +8730,12 @@ begin end; -procedure TMainForm.QueryGridFocusChanging(Sender: TBaseVirtualTree; OldNode, - NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; - var Allowed: Boolean); +procedure TMainForm.QueryGridFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); begin - if OldColumn <> NewColumn then - FocusGridCol(Sender, NewColumn); ValidateControls; end; -procedure TMainForm.FocusGridCol(Grid: TBaseVirtualTree; Column: TColumnIndex); -var - g: TVirtualStringTree; - MinX, MaxX, i: Integer; -begin - g := Grid as TVirtualStringTree; - MinX := 0; - for i:=0 to Column do - MinX := MinX + g.Header.Columns[i].Width; - MaxX := -(MinX - g.Header.Columns[Column].Width); - MinX := -(MinX - g.Width + 20); // Assume 20px for vertical scrollbar. - if g.OffsetX > MinX then - g.OffsetX := MinX - else if g.OffsetX < MaxX then - g.OffsetX := MaxX; -end; - - procedure TMainForm.pnlQueryHelpersCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean); begin