Skip to content

Commit f3e8786

Browse files
committed
Limit Unicode prefixes to six characters
Avoids drawing scrollbars that only obscure the tiny edit control Typing over selections will also work now that `TfpgMemo.MaxLength` is left unset
1 parent 203c3a9 commit f3e8786

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Forms/ConfigForm.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface
2525
FrmHeight = 112;
2626
FrmWidth = 400;
2727
BtnWidth = 85;
28+
MaxPrefixLen = 6;
2829

2930
type
3031
TFrmConfig = class(TfpgForm)
@@ -63,7 +64,6 @@ constructor TFrmConfig.Create(AOwner: TComponent);
6364
lblDigits := CreateLabel(self, (txtPrefix.Left + txtPrefix.Width + 2), lblFmt.Top, '0000', 64, 28);
6465
with txtPrefix do begin
6566
FontDesc := 'Consolas-8';
66-
MaxLength := 8;
6767
TabOrder := 0;
6868
OnPaint := ValidatePrefix;
6969
end;
@@ -127,6 +127,8 @@ procedure TFrmConfig.ValidatePrefix(Sender: TObject);
127127
begin
128128
Input := TfpgMemo(Sender).Text;
129129
btnOK.Enabled := (Length(Input) > 0) and (Ord(Input[1]) > $20);
130+
if Length(Input) > MaxPrefixLen then
131+
TfpgMemo(Sender).Text:= Copy(Input, 1, MaxPrefixLen);
130132
end;
131133

132134
procedure TFrmConfig.SetUpButton(var Btn: TfpgButton; Value: TfpgModalResult; Index: SmallInt; Icon: TfpgString);

0 commit comments

Comments
 (0)