Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
OnItemValidate picture event
Declaration
Global handler:
Special handler:
Blok kódu | ||||
---|---|---|---|---|
| ||||
ENTRY OnItemValidate(IN INT _refId, INT _row, INT _col, IN TEXT _value, BOOL _bValid) ; script actions END OnItemValidate |
Special handler:
Blok kódu | ||||
---|---|---|---|---|
| ||||
ENTRY XXX_OnItemValidate(INT _row, INT _col, IN TEXT _value, BOOL _bValid) ; script actions END XXX_OnItemValidate |
Parameters
_refId | Parameter of the INT type (required for global handler). |
XXX | Name of Reference variable connected to graphic object (without the character "_"). |
_row, _col | Row, column of the item, whose value must be validated. |
_value | New item value. |
_bValidate | Output parameter - value validity attribute. |
Description
The picture event is being generated by the displayer of the Browser type , if the user want wants to finish the editing of the item. Item The item is defined by a row (_row) and a column (_col). Owing to the backward compatibility, the parameter _col does not represent the index of column in a structure, but the order of column (from left), as it is displayed. Edited column must be of the Text type.
If the picture event handler sets the output parameter to the value @False, the user cannot carry out the change. If the picture event handler sets the output parameter to the value @True, the change will be accepted.
When using the picture event, it allows easy performing the input check.
Example
In the example below, the picture handler for the displayer of Browser type with the reference variable _browser checks whether a value entered by user is lower or equal to the number of the item row. If the input is OK, then user can edit the item placed bellow the current one. If the item is placed in last row, next item to edit will be in first row.
The Browser displays the structured variable _rec.
Blok kódu | ||||
---|---|---|---|---|
| ||||
ENTRY browser_OnItemValidate(INT _row, INT _col, IN TEXT _value, BOOL _bValid) IF _col = 1 THEN INT _val _val := %StrToI(_value) IF !_val\VLD THEN _bValid := @FALSE ELSIF _val > _row THEN _bValid := @FALSE ELSE _bValid := @TRUE _row := _row+1 IF _row > _rec\DIM THEN _row := 1 ENDIF ENDIF ELSE _bValid := @TRUE ENDIF END browser_OnItemValidate BEGIN REDIM _rec[10] END |
Global picture event handler:
Blok kódu | ||||
---|---|---|---|---|
| ||||
ENTRY OnItemValidate(IN INT _refId, INT _row, INT _col, IN TEXT _value, BOOL _bValid) |
Blok kódu | ||||
---|---|---|---|---|
| ||||
IF _refId = _browser THEN ;test that determines the displayer in which the event occurred |
Blok kódu | ||||
---|---|---|---|---|
| ||||
; script actions |
Blok kódu | ||||
---|---|---|---|---|
| ||||
ENDIF END OnItemValidate |
Note
Since the version 10.0.37 and higher, the next item for editing cannot be defined by the parameters _row and _col. This functionality is replaced by calling the function %HI_EditItem (for example from ENTRY OnItemChange).
Info | ||
---|---|---|
| ||