Issue #144: Let grid editors call TExtForm.FixControls on their MainControl, to support Ctrl+Backspace there.

This commit is contained in:
Ansgar Becker
2019-09-25 20:39:54 +02:00
parent d446db554a
commit 355db1403a
2 changed files with 14 additions and 7 deletions

View File

@ -20,7 +20,7 @@ type
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); class procedure FixControls(ParentComp: TComponent);
end; end;
// Memo replacement which accepts any line break format // Memo replacement which accepts any line break format
TLineNormalizingMemo = class(TMemo) TLineNormalizingMemo = class(TMemo)
@ -72,13 +72,12 @@ begin
end; end;
class procedure TExtForm.FixControls(FormOrFrame: TScrollingWincontrol); class procedure TExtForm.FixControls(ParentComp: TComponent);
var var
i: Integer; i: Integer;
Cmp: TComponent;
begin procedure ProcessSingleComponent(Cmp: TComponent);
for i:=0 to FormOrFrame.ComponentCount-1 do begin 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/
@ -99,6 +98,13 @@ begin
SHAutoComplete(TCustomEdit(Cmp).Handle, SHACF_AUTOAPPEND_FORCE_ON or SHACF_AUTOSUGGEST_FORCE_ON); SHAutoComplete(TCustomEdit(Cmp).Handle, SHACF_AUTOAPPEND_FORCE_ON or SHACF_AUTOSUGGEST_FORCE_ON);
end; end;
end; end;
begin
// Passed component itself may also be some control to be fixed
// e.g. TInplaceEditorLink.MainControl
ProcessSingleComponent(ParentComp);
for i:=0 to ParentComp.ComponentCount-1 do begin
ProcessSingleComponent(ParentComp.Components[i]);
end;
end; end;

View File

@ -8,7 +8,7 @@ uses
Windows, Forms, Graphics, Messages, VirtualTrees, ComCtrls, SysUtils, Classes, Windows, Forms, Graphics, Messages, VirtualTrees, ComCtrls, SysUtils, Classes,
StdCtrls, ExtCtrls, CheckLst, Controls, Types, Dialogs, Menus, Mask, DateUtils, Math, StdCtrls, ExtCtrls, CheckLst, Controls, Types, Dialogs, Menus, Mask, DateUtils, Math,
dbconnection, dbstructures, apphelpers, texteditor, bineditor, gnugettext, dbconnection, dbstructures, apphelpers, texteditor, bineditor, gnugettext,
StrUtils, System.UITypes, SynRegExpr, Vcl.Themes; StrUtils, System.UITypes, SynRegExpr, Vcl.Themes, extra_controls;
type type
// Radio buttons and checkboxes which do not pass <Enter> key to their parent control // Radio buttons and checkboxes which do not pass <Enter> key to their parent control
@ -304,6 +304,7 @@ begin
if Assigned(FMainControl) then begin if Assigned(FMainControl) then begin
FOldWindowProc := FMainControl.WindowProc; FOldWindowProc := FMainControl.WindowProc;
FMainControl.WindowProc := TempWindowProc; FMainControl.WindowProc := TempWindowProc;
TExtForm.FixControls(FMainControl);
end; end;
// Adjust editor position and allow repainting mainform // Adjust editor position and allow repainting mainform
SetBounds(FCellTextBounds); SetBounds(FCellTextBounds);