WEBGUI

wgGet

Edit a typed value with an input picture and validation

Syntax

Signature
wgGet():New( oParent, xValue, [cPicture], [cLabel] ) --> oGet
oGet:when := {| oGet | lAllow }
oGet:valid := {| oGet, xNewValue | lValid }
oGet:onChange := {| oGet | ... }

Arguments

oParent

Window or layout container.

xValue

Initial text, numeric, date or logical value. It determines the type of :value.

cPicture

Optional input and display picture.

cLabel

Optional label above the field. Assign :text to change it.

Return value

The GET field. when and valid must return .T. to allow focus or accept a changed value, respectively.

Description

The field checks its picture on Enter or when it loses focus. A changed value that passes the picture and valid is stored in :value and then onChange runs. Enter moves to the next focusable control after the picture check. Text that fails the picture is marked. When valid refuses a change, the field is marked and regains focus. when runs on focus and can skip the field.

TypePicture
Text9 accepts a digit, A a letter, ! a letter converted to uppercase, and X a non-control character. Other characters are literals. A leading @! uppercases the text. A backslash escapes the next character.
NumberUse a numeric picture such as "999,999.99". A prefix or suffix can accompany the number.
DateUse DD, MM and YYYY with the desired separators. The default is "DD.MM.YYYY".
LogicalUse two values separated by /, for example "Yes/No". The default is ".T./.F.".

Assign values of the original type to :value from xDev.

Notes

See webgui-get.prg in Examples.

See also