Prev
EhLib
User's guide

 Using data-aware edit controls

Common understanding of edit controls.

EhLib represents five data-aware edit controls for end users: TDBEditEh, TDBDateTimeEditEh, TDBComboBoxEh, TDBNumberEditEh and TDBLookupComboboxEh. EhLib have not nodata-aware version of these controls because every control can work as in data-aware mode as in not data-aware. The base class from which all EhLib edit controls are derived is TCustomDBEditEh. TCustomDBEditEh encapsulates the behavior that is common for edit controls for editing text and if required to edit a database field by introducing methods and properties that provide:

    Basic text editing functions such as selecting text, modifying selected text, and case conversions.
    Ability to respond to changes in the contents of the text.
    Access control of the text for making it read-only or introducing a password character to hide the actual value.
    Validity checking using an edit mask.
    Writing edited text to database field.
    Showing one or several edit buttons (with variable glyphs: dropdown arrow, Ellipsis arrow, up-down arrows, plus sign, minus sign or custom bitmap) at right part of edit box.
    Showing image at the left part of the edit box from image list.

Application can use Text (String type) and Value (Variant type) properties to get and set string or variant values to controls. Text property is a text that you can see controls. Value property hold value of variant type and can hold values of types depending of control type. It can hold Null value or:
    String type for TDBEditEh and TDBComboBoxEh,
    TDateTime, TDate, TTime, Double type for TDBDateTimeEditEh,
    All numeric types for TDBNumberEditEh,
    TDBLookupComboboxEh control hold value that depend of associated type of the field.

If control is connected to the field then assing data to the Text or Value properties automatically write data to the field.

Every control have Flat and AlwaysShowBorder properties to control the border apearance.

Working with edit butons.

Every edit control allows to have one or more edit buttons at right part. You can use EditButton and EditButtons to control them.

Using TDBDateTimeEditEh control.

TDBDateTimeEditEh represents a single-line date or/and time edit control that can display and edit a date or/and time values.

Property Kind determines whether the component is a date editor or/and a time editor (dtkDateEh, dtkTimeEh, dtkDateTimeEh) or custom date-time mask editor (dtkCustomEh).
Use EditFormat property to set custom date/time format. You can use next format elements: 'YY', 'YYYY', 'MM', 'DD', 'HH', 'NN', 'SS'.

By default TDBDateTimeEditEh build edit mask using ShortDateFormat variable. Edit mask can be by six types: three for four-char year - 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD' and three for two-char year 'MM/DD/YY', 'DD/MM/YY', 'YY/MM/DD'.

Application can use Text (String type) and Value (Variant type) properties to get and set datetime type value in TDBDateTimeEditEh. If TDBDateTimeEditEh is in dtkDateEh kind then it will change only date part of the field. If TDBDateTimeEditEh is in dtkTimeEh kind then it will change only time part of the field.

Using TDBNumberEditEh control.

TDBNumberEditEh represents a single-line number edit control that can display and edit a numeric values.

TDBNumberEditEh build display text from DisplayFormat property and show display text when control have not input focus.

Use properties of EditButton object to adjust the edit button in right part of edit control. When EditButton in UpDown style the control will work as spin edit. Use Increment property to specifies the value that is added or subtracted from Value when the user spins the control.

Using TDBComboBoxEh control.

TDBComboBoxEh component is an edit box with a scrollable drop-down list attached to it. Users can select an item from the list or type directly into the edit box.

TDBComboBoxEh permits a single line and multiple line of text. Use WordWrap property to set TDBComboBoxEh as multiple line editor.

Use Items property to access to the list of items (strings) in the list portion of the combo box.

Use KeyItems property to access to the list of items (strings) that the will store in field when Items property is sets too. When Items and KeyItems is filled then KeyList have to contain a values which kept in the field but Items in according index have to contain a values to show.

Use Images property to specifies the images that are drawn in the drop-down list and image drawn in left part of combobox. Index of drawing image is takes from ItemIndex property.

Using TDBLookupComboboxEh control.

TDBLookupComboBoxEh represents a combo box that identifies a set of field(s) values in one dataset with a corresponding set of values from another dataset. To understand 'lookup' concepts see Delphi help, Topic - Displaying and editing data in lookup list and combo boxes.

TDBLookupComboboxEh can have two style (Style property):
csDropDownEh - Application can assign and users can type text which does not contained in data list.
csDropDownListEh - Application can assign and users can type text only which present in data list.

If KeyField, ListField, ListSource, DataField and DataSource properties is empty then you can assign KeyValue and Text values that not affecting to each other.

Drop down window takes values from dataset that deterimes by ListSource propery.
Drop down list can:
    Show titles (Captions is taked from Field.FisplayLabel property),
    Show special nonscrolled row in top part of list (SpecRow propery).
    Have sizing grip (Sizable propery),
    Automaticaly set width as sum of DisplayWidth of the list fields (Width propery = -1),
    Automaticaly drops on user pressed the key (AutoDrop propery).
    Have specified width (Width propery).

Using SpecRow in columns of DBGridEh component and in DBLookupComboBoxEh component.

The SpecRow property of TDropDownBoxEh or DropDownSpecRow property of TColumnEh holds a TDropDownBoxEh object. TDropDownBoxEh defines attributes of the special row in the dropdown box.
TSpecRowEh contain next properies:

CellsText: String
Specifies the text(s). When dropdown box have more then one columns, use semicolon to separate text for each column.
Color: TColor
Background color of special row in dropdown box.
Font: TFont
Font of special row text.
Value: Variant
Value. Special row be selected when this value is equal to value of control in which it sprecial row belong.
Visible: Boolean
Specifies whether the spec row is active and visible in dropDown box
ShortCut: TShortCut
Specifies the shortcut for assinging value of specrow to control value.
ShowIfNotInKeyList: Boolean
Specifies whether the spec row text will be shows if value of the control not in list of key values.

TSpecRowEh represent the special row in the top part of dropdown box for lookup fields in column of DBGridEh and in TDropDownBoxEh class of TDBLookupComboboxEh component. This row will be active when lookup field or lookupcombobox have value equals specrow value or when value not in list of key value.


Next

EhLib Team
E-mail: support@ehlib.com