BCB: Simple implementation of TEDIT control right alignment

zhaozj2021-02-17  46

Implement the "edit box" right alignment

------------------------------------------------

Application: Usually used as an input value.

Implementation: Implement with MEMO components. It has right alignment properties.

------------------------------------------------

Memo's important property setting:

Alignment: TarightJustify [is it]

HEIGHT: single line height;

Maxlength: limit the number of input characters;

Scrollbars: ssnone;

Wantreturns: false;

WordWarp: false;

------------------------------------------------

[Note] - transform MEMO into a true single line text box. Above

After the setting, MEMO does not perform the carriage return, but press [Ctrl Enter]

When the combination key, Memo still has to go to the line, add two event code to this

Exclude this situation (the following event code is the shared event of each MEMO

Code, that is, pick them at each MEMO's Events page):

[1] "Key Press" Event Code:

TFORM1 :: Memo1KeyDown (...)

{

IF ((key == vk_return) && shift.contains (ssctrl))

((TMEMO *) Sender -> Readonly = True;

}

------------------------------------------------

[2] "Key" event code:

TFORM1 :: Memo1Keyup (...)

{

// if (key == vk_return) && shift.contains (ssctrl)) / / Don't this sentence, because it is sometimes failed!

((TMEMO *) Sender) -> Readonly = false;

}

转载请注明原文地址:https://www.9cbs.com/read-28618.html

New Post(0)