Skip to content

Commit

Permalink
Issue #144: Let grid editors call TExtForm.FixControls on their MainC…
Browse files Browse the repository at this point in the history
…ontrol, to support Ctrl+Backspace there.
  • Loading branch information
ansgarbecker committed Sep 25, 2019
1 parent d446db5 commit 355db14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 12 additions & 6 deletions source/extra_controls.pas
Expand Up @@ -20,7 +20,7 @@ TExtForm = class(TForm)
constructor Create(AOwner: TComponent); override;
procedure InheritFont(AFont: TFont);
property HasSizeGrip: Boolean read GetHasSizeGrip write SetHasSizeGrip default False;
class procedure FixControls(FormOrFrame: TScrollingWincontrol);
class procedure FixControls(ParentComp: TComponent);
end;
// Memo replacement which accepts any line break format
TLineNormalizingMemo = class(TMemo)
Expand Down Expand Up @@ -72,13 +72,12 @@ procedure TExtForm.DoShow;
end;


class procedure TExtForm.FixControls(FormOrFrame: TScrollingWincontrol);
class procedure TExtForm.FixControls(ParentComp: TComponent);
var
i: Integer;
Cmp: TComponent;
begin
for i:=0 to FormOrFrame.ComponentCount-1 do begin
Cmp := FormOrFrame.Components[i];

procedure ProcessSingleComponent(Cmp: TComponent);
begin
if (Cmp is TButton) and (TButton(Cmp).Style = bsSplitButton) then begin
// Work around broken dropdown (tool)button on Wine after translation:
// https://sourceforge.net/p/dxgettext/bugs/80/
Expand All @@ -99,6 +98,13 @@ class procedure TExtForm.FixControls(FormOrFrame: TScrollingWincontrol);
SHAutoComplete(TCustomEdit(Cmp).Handle, SHACF_AUTOAPPEND_FORCE_ON or SHACF_AUTOSUGGEST_FORCE_ON);
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;


Expand Down
3 changes: 2 additions & 1 deletion source/grideditlinks.pas
Expand Up @@ -8,7 +8,7 @@ interface
Windows, Forms, Graphics, Messages, VirtualTrees, ComCtrls, SysUtils, Classes,
StdCtrls, ExtCtrls, CheckLst, Controls, Types, Dialogs, Menus, Mask, DateUtils, Math,
dbconnection, dbstructures, apphelpers, texteditor, bineditor, gnugettext,
StrUtils, System.UITypes, SynRegExpr, Vcl.Themes;
StrUtils, System.UITypes, SynRegExpr, Vcl.Themes, extra_controls;

type
// Radio buttons and checkboxes which do not pass <Enter> key to their parent control
Expand Down Expand Up @@ -304,6 +304,7 @@ function TBaseGridEditorLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualN
if Assigned(FMainControl) then begin
FOldWindowProc := FMainControl.WindowProc;
FMainControl.WindowProc := TempWindowProc;
TExtForm.FixControls(FMainControl);
end;
// Adjust editor position and allow repainting mainform
SetBounds(FCellTextBounds);
Expand Down

0 comments on commit 355db14

Please sign in to comment.