SRVEdit TSRVEdit

Top  Previous  Next

TSRVEdit is a single-line plain-text edit control, with an optional popup list displaying hints (suggestions).

Unit SRVEdit;

Syntax

TSRVEdit = class(TSRVEditControl)

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TSRVWinControl

TSRVEditControl

Properties and events

This component publishes the following properties inherited from TSRVEditControl:

DrawOnPrint;

SkinManager;

SkinSchemeIndex, ScrollBarSkinSchemeIndex, ItemSkinSchemeIndex;

EnabledBorderColor, EnabledBorderWidth;

DisabledBorderColor, DisabledBorderWidth;

MouseInBorderColor, MouseInBorderWidth;

FocusedBorderColor, FocusedBorderWidth;

properties inherited from TWinControl.

New published properties:

Property

Type

Default value

Meaning

published AutoSize

Boolean

True

Determines whether the height of the edit control automatically resizes to accommodate the text height

published CharCase

TSRVEditCharCase

srvecNormal

Determines the case of the text within the edit control:

srvecNormal, srvecUpperCase, srvecLowerCase

published DropDownHints

Integer

10

Defines how many hints (suggestions) are visible in a list.

published MaxLength

Integer

0

Specifies the maximum number of characters the user can enter into the edit control (0 for unlimited)

published 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)

published ReadOnly

Boolean

False

Determines whether the user can change the text of the edit control

New public properties:

Property

Type

Initial value

Meaning

Modified

Boolean

 

Indicates whether the user edited the text of the edit control.

SelText

String

 

Specifies the selected portion of the edit control’s text. Set SelText to replace the selected text with a new string.

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: String; EditHints: TStringList; var ItemIndex : Integer) of object;

  TFormHintsClose = procedure(Sender: TObject; FormWidth, FormHeight: Integer;

    var NewText : Stringof object;

Methods

Clear deletes all text from the edit control.

ClearSelection removes the selected text from the edit control.

CopyToClipboard copies the selected text in the edit control to the Clipboard.

CutToClipboard copies the selected text in the edit control to the Clipboard and then deletes the selection.

PasteFromClipboard pastes the contents of the Clipboard into edit control, replacing the current selection.

Undo backs out all changes in the undo buffer.

ClearUndo clears the undo buffer so that no changes to the text can be backed out.

BeginUpdate locks redrawing and displaying hints (suggestions), EndUpdate unlocks them.

GetSelTextBuf copies the selected text into a buffer and returns the number of characters copied. SetSelTextBuf replaces the selected text with a null-terminated string.

ShowHints displays a list of hints (suggestions).

Hints (Suggestions)

A list of suggestions can be displayed on editing or by the method ShowHints. This feature can be temporary blocked using BeginUpdate/EndUpdate.

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).

Painting

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].

Example:

SRVEdit Scheme


ScaleRichView © trichview.com