Easy to Create, Easy to Change - Easy to use!


Tips! OML Event String and Event Returns


Started by DataEase
You will need to Sign In to be able to comment on the Blog!

Tips! OML Event String and Event Returns

Event Strings

The most useful part of OML is the Events. All other aspects of OML has in effect been replaced by functions in DE8, but events is the dimension you cannot replace as the essence of it is the triggering.

The navigation and exectutions of a DataEase form follow certain rules that we manipulate a lot to get things to happen the way we want. A virtual field will be re-calculated every time a dependency is change and this is very useful to get certain things to happen, but sometime we simply need to capture an event and then we talk OML.

OML has been fraught with problems, but it is heavily cleaned up in DE8 and is no stable as long as one follow some basic rules.

1. Make sure the object has a unique name. If you insert a subform with a field name already used in the form the OML will get confused and OML put on one object might revert to another.

2. When inserting objects in a form with OML the object order might confuse the OML as it relies on object order. 

If you use OML sparingly and only when you really need to the probability of getting problems are relatively small, but the risk rise exponentially with the use so take care.

Several events return a new value in the object's string property. String is a text property. If you wish to carry out mathematical operations or comparisons on string, then you need to work through a temporary variable.

Example: The code below is placed in a number field's PostEdit Event.

 

Define "MyVariable" number .

MyVariable := string .

if

MyOtherObject.value = "Discount"

then

MyVariable := MyVariable * 0.35 .

string := MyVariable .

redraw := 1 .

else

end .

...which conditionally (if MyOtherObject = discount) reduces the field's numerical content to 35% of its previous value.

List of Events

All the Events supported by DataEase 6 are listed and described below.

 

Event Name  Parameters     Description

Clicked

(Number ButtonID, Number xLoc, Number yLoc)

 

Fired when you perform a mouse click in the object.

ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

DblClicked

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when you double-click your mouse in an object.

ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

DownArrowClicked

()

 

This Event occurs if the Down Arrow in a SpinBox or 3DSpinBox is clicked.

GotFocus

()

 

Fires when a field is entered.

Note: If you put this event on the object which receives focus when a form is opened, it will NOT be triggered when the form opens. Technically the object already HAS focus, before the GotFocus Event can be evaluated.

PreEdit

()

 

Although PreEdit appears in the DataEase 6.0 Event Pick List, it is only available as a Method.

This event/method occurs immediately after a field gets the focus and before a user enters data in it.

The PreEdit event/method gets the field ready to be edited. For example, it allows the cursor to appear in the field, and highlights the text of existing values.

 

PostEdit

(Text String)

 

Fires after the field has been edited, whereupon the String parameter contains the new value. The object's value property still contains the old value.

Note: PostEdit fires before the ValueChange Event. This means that it fires before the object's derivation formula (if any) is evaluated. So if the user types in "10", and the derivation formula multiplies the input value by 5, then String will hold "10", and not "50".

So to modify the object's value, modify the string parameter. Use Event Return to either accept or reject the string value.

ValueLoaded

()

 

Triggered when a change is made to the field's value. This can result from a user editing the field, or from the action of a script or derivation, or simply pressing the F3 key.

Note that the ValueLoaded Event fires twice for every record.

ValueChange

(Text String)

 

Fired when field loses focus and the field's value differs from the stored (originally loaded from the Table) value.

The String parameter holds the new value, after all derivations and lookups have been performed.

You can not modify a field's value property using this event - because it occurs after the field's derivations have been carried out.

However you can check value, and either accept or reject it, by using the Event Return Flag.

 

ValueRequired

()

 

Can not be customised..

LostFocus

()

 

Fires when you exit from an object which previously held focus.

MouseDown

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when mouse button pressed. ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseUp

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when mouse button released. ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc:  The X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc:  The Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseMove

(Number xLoc, Number yLoc)

 

Fires when mouse moved in a visible object.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc: The X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc:  The Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseOver

()

 

Fires when mouse passes over a visible object.

MouseEnter

()

 

Fires when mouse enters a visible object.

MouseExit

()

 

Fires when mouse exits a visible object.

KeyDown

(Number KeyValue)

 

Fires when an object has the focus and a keyboard key is pushed down.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

KeyInput

(Number KeyValue)

 

Fires when a user presses a key that inputs a value while an object has the focus.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

KeyUp

(Number KeyValue)

 

Fires when a user releases a key while an object has the focus.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

UpArrowClicked

()

 

This Event occurs if the Up Arrow in a SpinBox or 3DSpinBox is clicked.

Keyboard Events

Usually the order of events is: KeyDown, KeyInput and KeyUp. However, there are certain keys for which there is no KeyInput event, and there are even a few keys that only trigger the KeyUp event.

Each event has an associated KeyValue event parameter, which is the ANSI number of the key concerned. The KeyValue for KeyDown and KeyUp is not modified by pressing other keys at the same time; the KeyInput KeyValue is modified by other keys. Principally, this means that, if the user holds down the Shift key and then presses 7 (ANSI 55), the KeyValue for both KeyDown and KeyUp will be 55, whereas KeyInput’s KeyValue will be 38, which is the ‘&’ character that appears above the ‘7’ on that key.

For alphabetical characters, pressing ‘A’ for KeyDown and KeyUp gets a value of 65, which is the upper case ANSI value, where KeyInput has 97, the lower case value for ‘a’.

All the following characters trigger KeyDown/KeyUp events only. Their KeyValue value is given in brackets:

Caps lock (20); Shift (16); Ctrl (17); Ctrl+Alt (18) (Alt on its own has no value); Windows button on left-hand side of keyboard (91); Windows button on right-hand side (92); Context button (93); ScollLock (145); Pause (19); Insert (45); Home (36); Page up (33); Delete (but not backspace) (46); End (35); Page Down (34); Up Cursor (38); Down Cursor (40); Left Cursor (37); Right Cursor (39); NumLock (144).

The behaviour of the function keys requires even more care. Generally, they are KeyDown/KeyUp events only, and have values from 112 for F1 to 123 for F12. If the function key has an action that is not for some reason disabled, or has no associated action, the KeyDown and KeyUp events will fire. But if, for example, F2-Save is disabled because the usage of the form is prevent data-entry, then only a KeyUp event occurs.

F10 triggers no events. Alt also usually has no value returned. Print Screen only fires a KeyUp event (with a KeyValue of 44).

Event Strings

Several events return a new value in the object's string property. String is a text property. If you wish to carry out mathematical operations or comparisons on string, then you need to work through a temporary variable.

Example: The code below is placed in a number field's PostEdit Event.

 

Define "MyVariable" number .

MyVariable := string .

if

MyOtherObject.value = "Discount"

then

MyVariable := MyVariable * 0.35 .

string := MyVariable .

redraw := 1 .

else

end .

...which conditionally (if MyOtherObject = discount) reduces the field's numerical content to 35% of its previous value.

List of Events

All the Events supported by DataEase 6 are listed and described below.

 

Event Name  Parameters     Description

Clicked

(Number ButtonID, Number xLoc, Number yLoc)

 

Fired when you perform a mouse click in the object.

ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

DblClicked

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when you double-click your mouse in an object.

ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

DownArrowClicked

()

 

This Event occurs if the Down Arrow in a SpinBox or 3DSpinBox is clicked.

GotFocus

()

 

Fires when a field is entered.

Note: If you put this event on the object which receives focus when a form is opened, it will NOT be triggered when the form opens. Technically the object already HAS focus, before the GotFocus Event can be evaluated.

PreEdit

()

 

Although PreEdit appears in the DataEase 6.0 Event Pick List, it is only available as a Method.

This event/method occurs immediately after a field gets the focus and before a user enters data in it.

The PreEdit event/method gets the field ready to be edited. For example, it allows the cursor to appear in the field, and highlights the text of existing values.

 

PostEdit

(Text String)

 

Fires after the field has been edited, whereupon the String parameter contains the new value. The object's value property still contains the old value.

Note: PostEdit fires before the ValueChange Event. This means that it fires before the object's derivation formula (if any) is evaluated. So if the user types in "10", and the derivation formula multiplies the input value by 5, then String will hold "10", and not "50".

So to modify the object's value, modify the string parameter. Use Event Return to either accept or reject the string value.

ValueLoaded

()

 

Triggered when a change is made to the field's value. This can result from a user editing the field, or from the action of a script or derivation, or simply pressing the F3 key.

Note that the ValueLoaded Event fires twice for every record.

ValueChange

(Text String)

 

Fired when field loses focus and the field's value differs from the stored (originally loaded from the Table) value.

The String parameter holds the new value, after all derivations and lookups have been performed.

You can not modify a field's value property using this event - because it occurs after the field's derivations have been carried out.

However you can check value, and either accept or reject it, by using the Event Return Flag.

 

ValueRequired

()

 

Can not be customised..

LostFocus

()

 

Fires when you exit from an object which previously held focus.

MouseDown

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when mouse button pressed. ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc  the X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc  the Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseUp

(Number ButtonID, Number xLoc, Number yLoc)

 

Fires when mouse button released. ButtonID: This indicates which button was pressed. 0 is left; 1 is right.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc:  The X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc:  The Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseMove

(Number xLoc, Number yLoc)

 

Fires when mouse moved in a visible object.

The xLoc and Yloc parameters (described below) are not available to the developer.

xLoc: The X co-ordinate in pixels of the mouse pointer when the event occurred.

yLoc:  The Y co-ordinate in pixels of the mouse pointer when the event occurred.

( 0 , 0 ) is the top left-hand corner of the form.

MouseOver

()

 

Fires when mouse passes over a visible object.

MouseEnter

()

 

Fires when mouse enters a visible object.

MouseExit

()

 

Fires when mouse exits a visible object.

KeyDown

(Number KeyValue)

 

Fires when an object has the focus and a keyboard key is pushed down.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

KeyInput

(Number KeyValue)

 

Fires when a user presses a key that inputs a value while an object has the focus.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

KeyUp

(Number KeyValue)

 

Fires when a user releases a key while an object has the focus.

KeyValue: The ANSI number of the key pressed. (This event is newly implemented in 6.5).

 

UpArrowClicked

()

 

This Event occurs if the Up Arrow in a SpinBox or 3DSpinBox is clicked.

Keyboard Events

Usually the order of events is: KeyDown, KeyInput and KeyUp. However, there are certain keys for which there is no KeyInput event, and there are even a few keys that only trigger the KeyUp event.

Each event has an associated KeyValue event parameter, which is the ANSI number of the key concerned. The KeyValue for KeyDown and KeyUp is not modified by pressing other keys at the same time; the KeyInput KeyValue is modified by other keys. Principally, this means that, if the user holds down the Shift key and then presses 7 (ANSI 55), the KeyValue for both KeyDown and KeyUp will be 55, whereas KeyInput’s KeyValue will be 38, which is the ‘&’ character that appears above the ‘7’ on that key.

For alphabetical characters, pressing ‘A’ for KeyDown and KeyUp gets a value of 65, which is the upper case ANSI value, where KeyInput has 97, the lower case value for ‘a’.

All the following characters trigger KeyDown/KeyUp events only. Their KeyValue value is given in brackets:

Caps lock (20); Shift (16); Ctrl (17); Ctrl+Alt (18) (Alt on its own has no value); Windows button on left-hand side of keyboard (91); Windows button on right-hand side (92); Context button (93); ScollLock (145); Pause (19); Insert (45); Home (36); Page up (33); Delete (but not backspace) (46); End (35); Page Down (34); Up Cursor (38); Down Cursor (40); Left Cursor (37); Right Cursor (39); NumLock (144).

The behaviour of the function keys requires even more care. Generally, they are KeyDown/KeyUp events only, and have values from 112 for F1 to 123 for F12. If the function key has an action that is not for some reason disabled, or has no associated action, the KeyDown and KeyUp events will fire. But if, for example, F2-Save is disabled because the usage of the form is prevent data-entry, then only a KeyUp event occurs.

F10 triggers no events. Alt also usually has no value returned. Print Screen only fires a KeyUp event (with a KeyValue of 44).

Written by DataEase 02/12/14 at 11:59:37 Dataease [{8}]FIVE
/static/images/blank.png