mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Prefill table combobox in trigger editor with currently selected table name. See issue #3477.
This commit is contained in:
@ -29,7 +29,9 @@ type
|
||||
private
|
||||
FModified: Boolean;
|
||||
FDefiners: TStringList;
|
||||
FFocusedTables: TDBObjectList;
|
||||
procedure SetModified(Value: Boolean);
|
||||
procedure SetFocusedTables(Value: TDBObjectList);
|
||||
protected
|
||||
public
|
||||
DBObject: TDBObject;
|
||||
@ -39,6 +41,7 @@ type
|
||||
function DeInit: TModalResult;
|
||||
function GetDefiners: TStringList;
|
||||
property Modified: Boolean read FModified write SetModified;
|
||||
property FocusedTables: TDBObjectList read FFocusedTables write SetFocusedTables;
|
||||
function ApplyModifications: TModalResult; virtual; abstract;
|
||||
end;
|
||||
TDBObjectEditorClass = class of TDBObjectEditor;
|
||||
@ -1800,10 +1803,12 @@ begin
|
||||
Align := alClient;
|
||||
InheritFont(Font);
|
||||
ScaleControls(Screen.PixelsPerInch, FORMS_DPI);
|
||||
FocusedTables := nil;
|
||||
end;
|
||||
|
||||
destructor TDBObjectEditor.Destroy;
|
||||
begin
|
||||
FFocusedTables.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -1812,6 +1817,14 @@ begin
|
||||
FModified := Value;
|
||||
end;
|
||||
|
||||
procedure TDBObjectEditor.SetFocusedTables(Value: TDBObjectList);
|
||||
begin
|
||||
if Value = nil then
|
||||
FFocusedTables := TDBObjectList.Create(False)
|
||||
else
|
||||
FFocusedTables := Value;
|
||||
end;
|
||||
|
||||
procedure TDBObjectEditor.Init(Obj: TDBObject);
|
||||
var
|
||||
editName: TWinControl;
|
||||
|
@ -3576,8 +3576,6 @@ var
|
||||
a: TAction;
|
||||
begin
|
||||
// Create a new table, view, etc.
|
||||
tabEditor.TabVisible := True;
|
||||
SetMainTab(tabEditor);
|
||||
a := Sender as TAction;
|
||||
Obj := TDBObject.Create(ActiveConnection);
|
||||
Obj.Database := ActiveDatabase;
|
||||
@ -9421,6 +9419,9 @@ begin
|
||||
ActiveObjectEditor.Parent := tabEditor;
|
||||
MainForm.SetupSynEditors;
|
||||
end;
|
||||
// Prefill editor with selected items. See issue #3477.
|
||||
ActiveObjectEditor.FocusedTables := GetFocusedObjects(Obj, [lntTable]);
|
||||
SetMainTab(tabEditor);
|
||||
ActiveObjectEditor.Init(Obj);
|
||||
UpdateFilterPanel(Self);
|
||||
end;
|
||||
@ -10142,6 +10143,7 @@ procedure TMainForm.SetMainTab(Page: TTabSheet);
|
||||
begin
|
||||
// Safely switch main tab
|
||||
if (Page <> nil) and (not FTreeRefreshInProgress) then begin
|
||||
Page.TabVisible := True;
|
||||
PagecontrolMain.ActivePage := Page;
|
||||
PageControlMain.OnChange(Page);
|
||||
end;
|
||||
|
@ -127,6 +127,14 @@ begin
|
||||
Raise Exception.Create(_('Trigger definition not found!'));
|
||||
end else begin
|
||||
editName.Text := '';
|
||||
if FocusedTables.Count > 0 then begin
|
||||
for i:=0 to comboTable.Items.Count-1 do begin
|
||||
if comboTable.Items[i] = FocusedTables[0].Name then begin
|
||||
comboTable.ItemIndex := i;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Modification(Self);
|
||||
Modified := False;
|
||||
|
Reference in New Issue
Block a user