Skip to content
Permalink
Browse files

Issue #144: make Ctrl+Backspace delete the last word of TEdit and TBu…

…ttonedEdit in any TExtForm
  • Loading branch information...
ansgarbecker committed Sep 25, 2019
1 parent 67967b4 commit 68994a4e4dd106446aefddfca45a22f130ed2be8
Showing with 13 additions and 3 deletions.
  1. +13 −3 source/extra_controls.pas
@@ -4,7 +4,8 @@ interface

uses
Classes, SysUtils, Forms, Windows, Messages, System.Types, StdCtrls, Clipbrd,
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext, Vcl.ImgList, Vcl.ComCtrls;
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext, Vcl.ImgList, Vcl.ComCtrls,
ShLwApi, Vcl.ExtCtrls;

type
// Form with a sizegrip in the lower right corner, without the need for a statusbar
@@ -59,18 +60,27 @@ constructor TExtForm.Create(AOwner: TComponent);
end else begin
TranslateComponent(Self);
end;
// Work around broken dropdown (tool)button on Wine after translation:
// https://sourceforge.net/p/dxgettext/bugs/80/

for i:=0 to ComponentCount-1 do begin
Cmp := Components[i];
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/
TButton(Cmp).Style := bsPushButton;
TButton(Cmp).Style := bsSplitButton;
end;
if (Cmp is TToolButton) and (TToolButton(Cmp).Style = tbsDropDown) then begin
// similar fix as above
TToolButton(Cmp).Style := tbsButton;
TToolButton(Cmp).Style := tbsDropDown;
end;
if Cmp is TCustomEdit then begin
// Support Ctr+Backspace for deleting last word in TEdit and TButtonedEdit
// See https://stackoverflow.com/questions/10305634/ctrlbackspace-in-delphi-controls
// See issue #144
// Todo: find a way to fix TComboBox, for which this hack does nothing
SHAutoComplete(TCustomEdit(Cmp).Handle, SHACF_AUTOAPPEND_FORCE_ON or SHACF_AUTOSUGGEST_FORCE_ON);
end;
end;
end;

0 comments on commit 68994a4

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