TMlSkinEdit

The skinned edit box. It works like a standard TEdit and adds a transparent background, placeholder text, input restrictions and in-box icons.

Category
Edits & pickers
Unit
uMlSkinEdit.pas
Inherits from
TMlSkinPngEditTMlSkinCustomControl

Notes

  • TextHint is the placeholder, shown in a light color while the box is empty.
  • TextKind limits input to digits, letters and so on, so there is no need to filter KeyPress yourself.
  • EdItems adds icons or small buttons inside the box, such as a clear or search icon on the right.
  • Tips pops a hint balloon next to the box, for example when validation fails.
  • The border uses two images, BorderNormal and BorderHot; turn BorderVisible off to drop it.

Example

From the demo MlSkin.Demo.360安全卫士.v3.1 (.dfm form file)

object edtB: TMlSkinEdit
  Left = 266
  Top = 115
  Width = 41
  Height = 21
  Cursor = crIBeam
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clBlack
  Font.Height = 13
  Font.Name = 'Tahoma'
  Font.Style = []
  FontHint.Charset = DEFAULT_CHARSET
  FontHint.Color = 11711154
  FontHint.Height = -11
  FontHint.Name = 'Tahoma'
  FontHint.Style = []
  BorderNormal = 'MlSkinBorderNormal'
  BorderHot = 'MlSkinBorderHot'
  EdItems = <>
  Space.Left = 4

Properties 15

NameTypeDefaultDescription
AutoSelectBooleanTrueSelects the existing text automatically when the control receives focus.
ShowCheckBoxBooleanFalseShows a check box at the left of the edit; its state is read and written through Checked.
CharCaseTEditCharCaseecNormalLetter case conversion: as typed, upper case or lower case.
CheckedBooleanFalseThe checked state.
FontHintTFontFont of the placeholder text, usually lighter than the main text.
BorderNormalTMlResIDBorder image in the normal state, given as an image ID or path.
BorderHotTMlResIDBorder image used on hover or while focused.
BorderVisibleBooleanTrueWhether the border is drawn.
ReadOnlyBooleanFalseRead-only: the content cannot be edited, but it can still be selected and copied.
TextstringThe text shown or typed in the control.
TextKindTMlTextKindtkAllRestricts what can be typed: tkAll anything, tkEN letters, tkNumInt integers, tkNumReal numbers with decimals and sign, tkENandNum letters and digits.
TextHintstringPlaceholder text shown in a light color while the control is empty, for example "Type a keyword".
MaxLengthInteger0Maximum number of characters; 0 means no limit.
EdItemsTMlEditItemsThe items inside the edit: each has its images (normal, hot, pressed), text, position and visibility — this is how clear, search or reveal-password buttons are built.
SpaceTMlSpaceSizePadding between the text and the border (left, top, right, bottom); switch its Active on first.

Events 1

NameTypeDefaultDescription
OnChangeTNotifyEventFires when the content changes.
Properties of TMlSkinPngEdit 3
NameTypeDefaultDescription
TextHintHideInKeyBooleanFalseWhen the placeholder disappears: with this on it stays while focused and hides only once a character is typed.
CursorColorTColorclBlackColour of the caret.
DisableIMEBooleanFalseDisables the IME so only Latin letters and digits can be typed — useful for account or serial number fields.
Properties of TMlSkinCustomControl 5
NameTypeDefaultDescription
AboutTMlAboutInfoA design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEventFires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEventFires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEventFires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEventFires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.