mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #144: Move some code out of TExtForm.OnCreate into .DoShow, where it works for more instances of TEdit, e.g. the database and table filter. Also, let the object editors call this code, as they don't derive from TExtForm.
This commit is contained in:
@ -369,7 +369,7 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses main;
|
uses main, extra_controls;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1869,6 +1869,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Mainform.ShowStatusMsg(_('Initializing editor ...'));
|
Mainform.ShowStatusMsg(_('Initializing editor ...'));
|
||||||
Mainform.LogSQL(Self.ClassName+'.Init, using object "'+Obj.Name+'"', lcDebug);
|
Mainform.LogSQL(Self.ClassName+'.Init, using object "'+Obj.Name+'"', lcDebug);
|
||||||
|
TExtForm.FixControls(Self);
|
||||||
DBObject := TDBObject.Create(Obj.Connection);
|
DBObject := TDBObject.Create(Obj.Connection);
|
||||||
DBObject.Assign(Obj);
|
DBObject.Assign(Obj);
|
||||||
Mainform.UpdateEditorTab;
|
Mainform.UpdateEditorTab;
|
||||||
|
@ -14,10 +14,13 @@ type
|
|||||||
FSizeGrip: TSizeGripXP;
|
FSizeGrip: TSizeGripXP;
|
||||||
function GetHasSizeGrip: Boolean;
|
function GetHasSizeGrip: Boolean;
|
||||||
procedure SetHasSizeGrip(Value: Boolean);
|
procedure SetHasSizeGrip(Value: Boolean);
|
||||||
|
protected
|
||||||
|
procedure DoShow; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure InheritFont(AFont: TFont);
|
procedure InheritFont(AFont: TFont);
|
||||||
property HasSizeGrip: Boolean read GetHasSizeGrip write SetHasSizeGrip default False;
|
property HasSizeGrip: Boolean read GetHasSizeGrip write SetHasSizeGrip default False;
|
||||||
|
class procedure FixControls(FormOrFrame: TScrollingWincontrol);
|
||||||
end;
|
end;
|
||||||
// Memo replacement which accepts any line break format
|
// Memo replacement which accepts any line break format
|
||||||
TLineNormalizingMemo = class(TMemo)
|
TLineNormalizingMemo = class(TMemo)
|
||||||
@ -35,8 +38,6 @@ implementation
|
|||||||
constructor TExtForm.Create(AOwner: TComponent);
|
constructor TExtForm.Create(AOwner: TComponent);
|
||||||
var
|
var
|
||||||
OldImageList: TCustomImageList;
|
OldImageList: TCustomImageList;
|
||||||
i: Integer;
|
|
||||||
Cmp: TComponent;
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
@ -61,8 +62,23 @@ begin
|
|||||||
TranslateComponent(Self);
|
TranslateComponent(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for i:=0 to ComponentCount-1 do begin
|
end;
|
||||||
Cmp := Components[i];
|
|
||||||
|
|
||||||
|
procedure TExtForm.DoShow;
|
||||||
|
begin
|
||||||
|
FixControls(Self);
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class procedure TExtForm.FixControls(FormOrFrame: TScrollingWincontrol);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Cmp: TComponent;
|
||||||
|
begin
|
||||||
|
for i:=0 to FormOrFrame.ComponentCount-1 do begin
|
||||||
|
Cmp := FormOrFrame.Components[i];
|
||||||
if (Cmp is TButton) and (TButton(Cmp).Style = bsSplitButton) then begin
|
if (Cmp is TButton) and (TButton(Cmp).Style = bsSplitButton) then begin
|
||||||
// Work around broken dropdown (tool)button on Wine after translation:
|
// Work around broken dropdown (tool)button on Wine after translation:
|
||||||
// https://sourceforge.net/p/dxgettext/bugs/80/
|
// https://sourceforge.net/p/dxgettext/bugs/80/
|
||||||
@ -76,6 +92,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if Cmp is TCustomEdit then begin
|
if Cmp is TCustomEdit then begin
|
||||||
// Support Ctr+Backspace for deleting last word in TEdit and TButtonedEdit
|
// Support Ctr+Backspace for deleting last word in TEdit and TButtonedEdit
|
||||||
|
// This did not work in OnCreate, so here's it in OnShow
|
||||||
// See https://stackoverflow.com/questions/10305634/ctrlbackspace-in-delphi-controls
|
// See https://stackoverflow.com/questions/10305634/ctrlbackspace-in-delphi-controls
|
||||||
// See issue #144
|
// See issue #144
|
||||||
// Todo: find a way to fix TComboBox, for which this hack does nothing
|
// Todo: find a way to fix TComboBox, for which this hack does nothing
|
||||||
|
Reference in New Issue
Block a user