@@ -216,6 +216,7 @@ TQueryHistoryItemComparer = class(TComparer<TQueryHistoryItem>)
216216
217217 TMainForm = class(TExtForm)
218218 actCopyColumnNames: TAction;
219+ actDataEditWithoutLookup: TAction;
219220 actPreferencesSQL: TAction;
220221 MainMenu1: TMainMenu;
221222 MainMenuFile: TMenuItem;
@@ -224,6 +225,7 @@ TMainForm = class(TExtForm)
224225 FollowForeignKey: TMenuItem;
225226 menuColorScheme: TMenuItem;
226227 MenuItem3: TMenuItem;
228+ menuDataEditWithoutLookup: TMenuItem;
227229 menuRenameSnippet: TMenuItem;
228230 menuSQLpreferences: TMenuItem;
229231 menuQFdummy: TMenuItem;
@@ -831,6 +833,7 @@ TMainForm = class(TExtForm)
831833 actCopyFormatted: TAction;
832834 Copyformattedtext1: TMenuItem;
833835 procedure actCreateDBObjectExecute(Sender: TObject);
836+ procedure actDataEditWithoutLookupExecute(Sender: TObject);
834837 procedure actNextTabExecute(Sender: TObject);
835838 procedure actPreviousTabExecute(Sender: TObject);
836839 procedure DataGridContextPopup(Sender: TObject; MousePos: TPoint;
@@ -1281,6 +1284,7 @@ TMainForm = class(TExtForm)
12811284 FCreateDatabaseDialog: TCreateDatabaseForm;
12821285 FTableToolsDialog: TfrmTableTools;
12831286 FGridEditFunctionMode: Boolean;
1287+ FDataEditWithoutLookup: Boolean;
12841288 FClipboardHasNull: Boolean;
12851289 FTimeZoneOffset: Integer;
12861290 FGridCopying: Boolean;
@@ -1705,6 +1709,11 @@ procedure TMainForm.actGridEditFunctionExecute(Sender: TObject);
17051709 ActiveGrid.EditNode(ActiveGrid.FocusedNode, ActiveGrid.FocusedColumn);
17061710end;
17071711
1712+ procedure TMainForm.actDataEditWithoutLookupExecute(Sender: TObject);
1713+ begin
1714+ FDataEditWithoutLookup := True;
1715+ DataGrid.EditNode(DataGrid.FocusedNode, DataGrid.FocusedColumn);
1716+ end;
17081717
17091718procedure TMainForm.StoreLastSessions;
17101719var
@@ -5918,7 +5927,7 @@ procedure TMainForm.DataGridBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
59185927 col := vt.Header.Columns.Add;
59195928 col.Text := TblCol.Name;
59205929 col.Hint := TblCol.Comment;
5921- col.Options := col.Options + [coSmartResize];
5930+ col.Options := col.Options + [coSmartResize, coEditable ];
59225931 if DatagridHiddenColumns.IndexOf(TblCol.Name) > -1 then
59235932 col.Options := col.Options - [coVisible];
59245933 // Column header icon
@@ -6602,6 +6611,7 @@ procedure TMainForm.ValidateControls(Sender: TObject);
66026611 actDataCancelChanges.Enabled := HasConnection and GridHasChanges;
66036612 actDataSaveBlobToFile.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
66046613 actGridEditFunction.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
6614+ actDataEditWithoutLookup.Enabled := HasConnection and inDataTab;
66056615 actDataPreview.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
66066616 actDataOpenUrl.Enabled := (Length(CellText)<SIZE_MB) and ExecRegExpr('^(https?://[^\s]+|www\.\w\S+)$', CellText);
66076617 actUnixTimestampColumn.Enabled := HasConnection and inDataTab and EnableTimestamp;
@@ -7982,6 +7992,7 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
79827992begin
79837993 // Manipulate quick filter menuitems
79847994 Grid := ActiveGrid;
7995+ FLastMouseButtonUpOnGrid := mbLeft;
79857996 // Make sure ValidateControls detects the grid as focused, which is not the case when
79867997 // it has 0 nodes, even with TreeOptions.SelectionOptions.RightclickSelect enabled
79877998 Grid.SetFocus;
@@ -10710,7 +10721,6 @@ procedure TMainForm.AnyGridNewText(Sender: TBaseVirtualTree; Node: PVirtualNode;
1071010721 on E:Exception do
1071110722 ErrorDialog(E.Message);
1071210723 end;
10713- FGridEditFunctionMode := False;
1071410724 ValidateControls(Sender);
1071510725end;
1071610726
@@ -10757,6 +10767,9 @@ procedure TMainForm.AnyGridFocusChanged(Sender: TBaseVirtualTree; Node: PVirtual
1075710767 Sender.ScrollIntoView(Sender.FocusedNode, False, True);
1075810768 // Required for highlighting fields with same text
1075910769 Sender.Invalidate;
10770+ // Reset flags when moving focus
10771+ FGridEditFunctionMode := False;
10772+ FDataEditWithoutLookup := False;
1076010773end;
1076110774
1076210775
@@ -10837,7 +10850,6 @@ procedure TMainForm.AnyGridEdited(Sender: TBaseVirtualTree; Node:
1083710850 if ([tsEditing, tsEditPending] * Sender.TreeStates) = [] then begin
1083810851 actDataCancelChanges.ShortCut := KeyToShortCut(VK_ESCAPE, []);
1083910852 actDataPostChanges.ShortCut := KeyToShortCut(VK_RETURN, [ssCtrl]);
10840- FGridEditFunctionMode := False;
1084110853 end;
1084210854end;
1084310855
@@ -10875,6 +10887,7 @@ procedure TMainForm.AnyGridCreateEditor(Sender: TBaseVirtualTree; Node:
1087510887 ResultCol: Integer;
1087610888begin
1087710889 VT := Sender as TVirtualStringTree;
10890+ EditLink := nil;
1087810891 Results := GridResult(VT);
1087910892 RowNum := VT.GetNodeData(Node);
1088010893 Results.RecNo := RowNum^;
@@ -10885,7 +10898,7 @@ procedure TMainForm.AnyGridCreateEditor(Sender: TBaseVirtualTree; Node:
1088510898 TblColumn := Results.ColAttributes(ResultCol);
1088610899
1088710900 // Find foreign key values
10888- if AppSettings.ReadBool(asForeignDropDown) and (Sender = DataGrid) then begin
10901+ if AppSettings.ReadBool(asForeignDropDown) and (Sender = DataGrid) and (not FDataEditWithoutLookup) then begin
1088910902 for ForeignKey in SelectedTableForeignKeys do begin
1089010903 idx := ForeignKey.Columns.IndexOf(DataGrid.Header.Columns[Column].Text);
1089110904 if idx > -1 then try
0 commit comments