<< Click to display table of contents >> TSRVEdit |
TSRVEdit is a single-line plain-text edit control, with an optional popup list displaying hints (suggestions).
TSRVEdit edits Unicode text in all versions of Delphi.
Unit SRVEdit;
Syntax
TSRVEdit = class(TCustomSRVEdit)
TObject
TPersistent
TComponent
TControl
TWinControl
This component publishes the following new properties and properties inherited from TCustomSRVEdit:
Property |
Type |
Default value |
Meaning |
---|---|---|---|
Alignment |
TAlignment |
taLeftJustify |
Horizontal text alignment (left/right/center). RTL BiDiMode inverts left and right alignments. |
AutoSelect |
Boolean |
True |
Determines whether all the text in the edit control is automatically selected when the control gets focus. |
AutoShowHints |
Boolean |
True |
Determines whether hints (suggestions) are shown when the control is focused and when its text is edited. They can also be displayed by DisplayHints method. |
AutoSize |
Boolean |
True |
Determines whether the height of the edit control automatically resizes to accommodate the text height. |
CharCase |
TSRVEditCharCase |
srvecNormal |
Determines the case of the text within the edit control: srvecNormal, srvecUpperCase, srvecLowerCase |
DropDownHints |
Integer |
10 |
Defines how many hints (suggestions) are visible in a list. |
MaxLength |
Integer |
0 |
Specifies the maximum number of characters the user can enter into the edit control (0 for unlimited) |
NumbersOnly |
Boolean |
False |
Allows only numbers to be typed into the text edit. |
PasswordChar |
Char |
#0 |
Indicates the character, if any, to display in place of the actual characters typed in the control (#0 to disable this feature) |
ReadOnly |
Boolean |
False |
Determines whether the user can change the text of the edit control |
SRVControlStyle |
srvcsSimple |
Defines a visual appearance (mainly affects border colors) |
|
Text |
TRVUnicodeString |
|
Contains a text displayed by the editor. |
•DrawOnPrint;
•SkinManager;
•EditSkinSchemeIndex, SkinSchemeIndex (used in the hints window), ScrollBarSkinSchemeIndex (used in the hints window), ItemSkinSchemeIndex (used in the hints window);
•SkinFontIndex;
•EnabledBorderColor, DisabledBorderColor, MouseInBorderColor, FocusedBorderColor (all colors are used only if SRVControlStyle = rvsrvcsClassic)
•DisabledBorderWidth, EnabledBorderWidth, MouseInBorderWidth, FocusedBorderWidth;
•properties inherited from TWinControl.
New published events:
•OnChange occurs when the text for the edit control may have changed.
•OnEditHints: TSRVEditHintsEvent occurs when a list of hints (suggestions) is about to be displayed.
•OnCloseHints: TFormHintsClose occurs when a list of hints (suggestions) is closed.
type
TSRVEditHintsEvent = procedure (Sender: TSRVEditControl;
Text: TRVUnicodeString; EditHints: TRVStringList;
var ItemIndex : Integer) of object;
TFormHintsClose = procedure(Sender: TObject;
FormWidth, FormHeight: Integer;
var NewText: TRVUnicodeString) of object;
where TRVStringList is a string list that contains Unicode string in all versions of Delphi (for Delphi 2009+, it contains UnicodeString items; for older versions of Delphi, it contains UTF-8 strings).
DisplayHints displays a list of hints (suggestions).
BeginHintsUpdate, EndHintsUpdate blocks/unblocks hints (suggestions) showing.
See also the methods inherited from TCustomSRVEdit.
A list of suggestions can be displayed on editing or by the method ShowHints. This feature can be temporary blocked using BeginHintsUpdate/EndHintsUpdate.
Suggestions are requested in the event OnEditHints. In this event, you can fill a list of suggestions (EditHints) for the Text, and specify the Index of item to highlight initially.
A height of this list is defined in DropDownHints property.
When a list of suggestions is closed, OnCloseHints event occurs. The parameter NewText contains the chosen suggestion (it is empty if canceled).
If skins are not defined:
The border around the editor has width defined in DisabledBorderWidth, EnabledBorderWidth, MouseInBorderWidth, FocusedBorderWidth properties. When auto-sizing the editor, it is assumed that the border width is equal to EnabledBorderWidth.
A border color depends on the editors state (normal, disabled, under the mouse pointer, focused) and SRVControlStyle: TSRVControlStyle property. If it is equal to srvcsSimple, colors are defined by RVControlsPainter (see the TRichView manual). If it is equal to srvcsClassic, colors are defined in EnabledBorderColor, DisabledBorderColor, MouseInBorderColor, FocusedBorderColor properties.
If SkinManager is assigned:
•the control is drawn using SkinManager.CurrentSkin.BoxSchemes[EditSkinSchemeIndex];
•a list of hints (suggestions) is drawn using SkinManager.CurrentSkin.BoxSchemes[SkinSchemeIndex];
•each item in this list is drawn using SkinManager.CurrentSkin.BoxSchemes[ItemSkinSchemeIndex];
•a scrollbar of this list is drawn using SkinManager.CurrentSkin.VerticalScrollBarSchemes[ScrollBarSkinSchemeIndex].
•font is defined in SkinManager.CurrentSkin.Fonts[SkinFontIndex].
Example: