Make foreign values drop down optionally. See http://www.heidisql.com/forum.php?t=11816

This commit is contained in:
Ansgar Becker
2013-02-04 18:30:35 +00:00
parent 3b56ed5b6f
commit e1c4f14dbc
4 changed files with 49 additions and 35 deletions

View File

@ -172,7 +172,7 @@ type
asFieldEditorSet, asFieldNullBackground, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile,
asActionShortcut1, asActionShortcut2, asHighlighterForeground, asHighlighterBackground, asHighlighterStyle,
asListColWidths, asListColsVisible, asListColPositions, asListColSort, asSessionFolder,
asRecentFilter, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asUnused);
asRecentFilter, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asForeignDropDown, asUnused);
TAppSetting = record
Name: String;
Session: Boolean;
@ -3209,6 +3209,7 @@ begin
InitSetting(asDateTimeEditorCursorPos, 'DateTimeEditor_CursorPos_Type%s', 0);
InitSetting(asAppLanguage, 'Language', 0, False, '');
InitSetting(asAutoExpand, 'AutoExpand', 0, False);
InitSetting(asForeignDropDown, 'ForeignDropDown', 0, True);
end;

View File

@ -7896,7 +7896,8 @@ begin
Conn := Results.Connection;
// Find foreign key values on InnoDB table cells
if Sender = DataGrid then for ForeignKey in SelectedTableForeignKeys do begin
if AppSettings.ReadBool(asForeignDropDown) and (Sender = DataGrid) then begin
for ForeignKey in SelectedTableForeignKeys do begin
idx := ForeignKey.Columns.IndexOf(DataGrid.Header.Columns[Column].Text);
if idx > -1 then try
// Find the first text column if available and use that for displaying in the pulldown instead of using meaningless id numbers
@ -7937,6 +7938,7 @@ begin
// Error gets logged, do nothing more here. All other exception types raise please.
end;
end;
end;
FGridEditFunctionMode := FGridEditFunctionMode or Results.IsFunction(Column);
if FGridEditFunctionMode then begin

View File

@ -835,6 +835,14 @@ object optionsform: Toptionsform
Caption = 'Remember filters, sorting and column selection across sessions'
TabOrder = 17
end
object chkForeignDropDown: TCheckBox
Left = 8
Top = 302
Width = 433
Height = 17
Caption = 'Drop down values from foreign table in InnoDB rows'
TabOrder = 18
end
end
object tabShortcuts: TTabSheet
Caption = 'Shortcuts'

View File

@ -119,6 +119,7 @@ type
chkRememberFilters: TCheckBox;
lblLanguage: TLabel;
comboAppLanguage: TComboBox;
chkForeignDropDown: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@ -276,6 +277,7 @@ begin
AppSettings.WriteBool(asFieldEditorEnum, chkEditorEnum.Checked);
AppSettings.WriteBool(asFieldEditorSet, chkEditorSet.Checked);
AppSettings.WriteBool(asRememberFilters, chkRememberFilters.Checked);
AppSettings.WriteBool(asForeignDropDown, chkForeignDropDown.Checked);
AppSettings.WriteBool(asCompletionProposal, chkCompletionProposal.Checked);
AppSettings.WriteBool(asTabsToSpaces, chkTabsToSpaces.Checked);
@ -478,6 +480,7 @@ begin
chkEditorEnum.Checked := AppSettings.ReadBool(asFieldEditorEnum);
chkEditorSet.Checked := AppSettings.ReadBool(asFieldEditorEnum);
chkRememberFilters.Checked := AppSettings.ReadBool(asRememberFilters);
chkForeignDropDown.Checked := AppSettings.ReadBool(asForeignDropDown);
// Shortcuts
TreeShortcutItems.ReinitChildren(nil, True);