@@ -8192,15 +8192,17 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
81928192 menuSQLHelpData.Enabled := InDataGrid;
81938193 Refresh3.Enabled := InDataGrid;
81948194 actGridEditFunction.Enabled := CellFocused;
8195+ actFollowForeignKey.Enabled := False;
81958196
81968197 if not CellFocused then
81978198 Exit;
8199+ if not InDataGrid then
8200+ Exit;
81988201 Results := GridResult(Grid);
81998202
82008203 Datatype := Results.DataType(Grid.FocusedColumn-1);
82018204 Col := Results.Connection.QuoteIdent(Results.ColumnOrgNames[Grid.FocusedColumn-1], False);
8202- if InDataGrid
8203- and (Datatype.Index = dbdtJson)
8205+ if (Datatype.Index = dbdtJson)
82048206 and Results.Connection.Parameters.IsAnyPostgreSQL then begin
82058207 Col := Col + '::text';
82068208 end;
@@ -8218,7 +8220,7 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
82188220 HasNotNullValue := False;
82198221 OldDataLocalNumberFormat := DataLocalNumberFormat;
82208222 DataLocalNumberFormat := False;
8221- IncludedValues := TStringList.Create;
8223+ IncludedValues := TStringList.Create; // Used to skip duplicates
82228224 while Assigned(Node) do begin
82238225 AnyGridEnsureFullRow(Grid, Node);
82248226 RowNumber := Grid.GetNodeData(Node);
@@ -8246,7 +8248,7 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
82468248 end;
82478249 end;
82488250 Node := Grid.GetNextSelected(Node);
8249- if Length(actQuickFilterFocused1.Hint) > SIZE_MB then
8251+ if Length(actQuickFilterFocused1.Hint) > SIZE_KB then
82508252 Break;
82518253 end;
82528254 DataLocalNumberFormat := OldDataLocalNumberFormat;
@@ -8333,20 +8335,17 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
83338335 // Stop here
83348336 if Act = actRemoveFilter then
83358337 Break;
8336- if not Act.Hint.IsEmpty then
8338+ if not IsEmpty( Act.Hint) then
83378339 Act.Caption := StrEllipsis(Act.Hint, 100);
83388340 end;
83398341
8340- actFollowForeignKey.Enabled := False;
8341- if (InDataGrid) then begin
8342- FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn-1];
8343- //find foreign key for current column
8344- for ForeignKey in ActiveDBObj.TableForeignKeys do begin
8345- i := ForeignKey.Columns.IndexOf(FocusedColumnName);
8346- if i > -1 then begin
8347- actFollowForeignKey.Enabled := True;
8348- break;
8349- end;
8342+ FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn-1];
8343+ //find foreign key for current column
8344+ for ForeignKey in ActiveDBObj.TableForeignKeys do begin
8345+ i := ForeignKey.Columns.IndexOf(FocusedColumnName);
8346+ if i > -1 then begin
8347+ actFollowForeignKey.Enabled := True;
8348+ break;
83508349 end;
83518350 end;
83528351end;
0 commit comments