Skip to content
Permalink
Browse files

Issue #144: Let grid editors call TExtForm.FixControls on their MainC…

…ontrol, to support Ctrl+Backspace there.
  • Loading branch information...
ansgarbecker committed Sep 25, 2019
1 parent d446db5 commit 355db1403aff5c7d061962f3ca21c62bcd8001f8
Showing with 14 additions and 7 deletions.
  1. +12 −6 source/extra_controls.pas
  2. +2 −1 source/grideditlinks.pas
@@ -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)
@@ -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/
@@ -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;


@@ -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
@@ -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);

0 comments on commit 355db14

Please sign in to comment.
You can’t perform that action at this time.