@@ -197,11 +197,13 @@ TQueryHistoryItemComparer = class(TComparer<TQueryHistoryItem>)
197197 end;
198198
199199 TMainForm = class(TExtForm)
200+ actDataEditWithoutLookup: TAction;
200201 MainMenu1: TMainMenu;
201202 MainMenuFile: TMenuItem;
202203 FileNewItem: TMenuItem;
203204 MainMenuHelp: TMenuItem;
204205 FollowForeignKey: TMenuItem;
206+ menuDataEditWithoutLookup: TMenuItem;
205207 menuRenameSnippet: TMenuItem;
206208 N1: TMenuItem;
207209 FileExitItem: TMenuItem;
@@ -813,6 +815,7 @@ TMainForm = class(TExtForm)
813815 actCopyFormatted: TAction;
814816 Copyformattedtext1: TMenuItem;
815817 procedure actCreateDBObjectExecute(Sender: TObject);
818+ procedure actDataEditWithoutLookupExecute(Sender: TObject);
816819 procedure menuConnectionsPopup(Sender: TObject);
817820 procedure actExitApplicationExecute(Sender: TObject);
818821 procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
@@ -1264,6 +1267,7 @@ TMainForm = class(TExtForm)
12641267 FCreateDatabaseDialog: TCreateDatabaseForm;
12651268 FTableToolsDialog: TfrmTableTools;
12661269 FGridEditFunctionMode: Boolean;
1270+ FDataEditWithoutLookup: Boolean;
12671271 FClipboardHasNull: Boolean;
12681272 FTimeZoneOffset: Integer;
12691273 FGridCopying: Boolean;
@@ -1743,6 +1747,11 @@ procedure TMainForm.actGridEditFunctionExecute(Sender: TObject);
17431747 ActiveGrid.EditNode(ActiveGrid.FocusedNode, ActiveGrid.FocusedColumn);
17441748end;
17451749
1750+ procedure TMainForm.actDataEditWithoutLookupExecute(Sender: TObject);
1751+ begin
1752+ FDataEditWithoutLookup := True;
1753+ DataGrid.EditNode(DataGrid.FocusedNode, DataGrid.FocusedColumn);
1754+ end;
17461755
17471756procedure TMainForm.StoreLastSessions;
17481757var
@@ -5971,7 +5980,7 @@ procedure TMainForm.DataGridBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
59715980 col := vt.Header.Columns.Add;
59725981 col.Text := TblCol.Name;
59735982 col.Hint := TblCol.Comment;
5974- col.Options := col.Options + [coSmartResize];
5983+ col.Options := col.Options + [coSmartResize, coEditable ];
59755984 if DatagridHiddenColumns.IndexOf(TblCol.Name) > -1 then
59765985 col.Options := col.Options - [coVisible];
59775986 // Column header icon
@@ -6656,6 +6665,7 @@ procedure TMainForm.ValidateControls(Sender: TObject);
66566665 actDataCancelChanges.Enabled := HasConnection and GridHasChanges;
66576666 actDataSaveBlobToFile.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
66586667 actGridEditFunction.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
6668+ actDataEditWithoutLookup.Enabled := HasConnection and inDataTab;
66596669 actDataPreview.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
66606670 actDataOpenUrl.Enabled := (Length(CellText)<SIZE_MB) and ExecRegExpr('^(https?://[^\s]+|www\.\w\S+)$', CellText);
66616671 actUnixTimestampColumn.Enabled := HasConnection and inDataTab and EnableTimestamp;
@@ -10953,7 +10963,6 @@ procedure TMainForm.AnyGridNewText(Sender: TBaseVirtualTree; Node: PVirtualNode;
1095310963 on E:Exception do
1095410964 ErrorDialog(E.Message);
1095510965 end;
10956- FGridEditFunctionMode := False;
1095710966 ValidateControls(Sender);
1095810967end;
1095910968
@@ -11000,6 +11009,9 @@ procedure TMainForm.AnyGridFocusChanged(Sender: TBaseVirtualTree; Node: PVirtual
1100011009 Sender.ScrollIntoView(Sender.FocusedNode, False, True);
1100111010 // Required for highlighting fields with same text
1100211011 Sender.Invalidate;
11012+ // Reset flags when moving focus
11013+ FGridEditFunctionMode := False;
11014+ FDataEditWithoutLookup := False;
1100311015end;
1100411016
1100511017
@@ -11077,7 +11089,6 @@ procedure TMainForm.AnyGridEdited(Sender: TBaseVirtualTree; Node:
1107711089 if ([tsEditing, tsEditPending] * Sender.TreeStates) = [] then begin
1107811090 actDataCancelChanges.ShortCut := TextToShortcut('Esc');
1107911091 actDataPostChanges.ShortCut := TextToShortcut('Ctrl+Enter');
11080- FGridEditFunctionMode := False;
1108111092 end;
1108211093end;
1108311094
@@ -11115,6 +11126,7 @@ procedure TMainForm.AnyGridCreateEditor(Sender: TBaseVirtualTree; Node:
1111511126 ResultCol: Integer;
1111611127begin
1111711128 VT := Sender as TVirtualStringTree;
11129+ EditLink := nil;
1111811130 Results := GridResult(VT);
1111911131 RowNum := VT.GetNodeData(Node);
1112011132 Results.RecNo := RowNum^;
@@ -11125,7 +11137,7 @@ procedure TMainForm.AnyGridCreateEditor(Sender: TBaseVirtualTree; Node:
1112511137 TblColumn := Results.ColAttributes(ResultCol);
1112611138
1112711139 // Find foreign key values
11128- if AppSettings.ReadBool(asForeignDropDown) and (Sender = DataGrid) then begin
11140+ if AppSettings.ReadBool(asForeignDropDown) and (Sender = DataGrid) and (not FDataEditWithoutLookup) then begin
1112911141 for ForeignKey in SelectedTableForeignKeys do begin
1113011142 idx := ForeignKey.Columns.IndexOf(DataGrid.Header.Columns[Column].Text);
1113111143 if idx > -1 then try
0 commit comments