<<

Contents

Search

>>

 

ON

 

 

Instruction

 

 

Syntax:

ON <Key> MACRO <Macroname>[,<Helptext>]

ON <Event> MACRO <Macroname>[,<Helptext>]

 

ON <Key> RESET

ON <Event> RESET

 

<Macroname>

= <MACRONAME>

<Helptext>

= <STRING-EXPRESSION>

 

Meaning:

The ON <Key> MACRO is executed if the key <Key> is pressed in a mask field. The following keys are allowed:

 

F1, F2,..., F24

SF1,…,SF12

PGUP, PGDN

CURSUP, CURSDN, CURSL, CURSR

SHIFT_CURSUP, SHIFT_CURSDN, SHIFT_CURSL, SHIFT_CURSR

INS, DEL

TABRIGHT, TABLEFT

END, ESC, HOME

 

In the macro <Macroname> it can be checked with GET_KEYSTATE whether one of the keys Alt or Ctrl was pressed simultaneously with the key <Key>.

 

Before the ON <Key> MACRO is executed the current mask field content is assigned to the variables EBUS_FDATA and EBUS_FDATA$.

 

In the <Helptext> an icon can be specified that is shown in the toolbar by the keys F1,…,F24,SF1,…,SF12. In addition a text can be specified that is displayed when the mouse is over the icon. <Helptext> has the following structure:

 

 [@<Iconname>,]<Text>

 

<Iconname> = <STRING EXPRESSION>

<Text> = <STRING EXPRESSION>

 

The ON <Key> Macros are local as to main- and subprograms. This means that each main- and subprogram has their own ON <Key> Macros.

 

ON <Key> RESET disables an ON <Key> MACRO again.

 

 

The ON <Event> MACRO is executed if the event takes place. The following events are possible:

 

Event

Meaning

BEGIN_READ(<INDEX FILE>)

The Macro is executed before the read access (READ, START, READ-NEXT, READ-PREVIOUS). If the variable EBUS_TRANSFER is set = 0 in the macro, the data record is not read and the error number 1098 is returned in OK.

 

DELETE(<INDEX FILE>)

The Macro is always executed if a delete access of the Index File <INDEX FILE> has taken place and no error has occurred.

 

DELETE_ALL

The Macro is executed every time after a successful delete operation of  any Index File.

 

DOUBLECLICK

The Macro is always executed if a mask is double-clicked with the left mouse button.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the clicked mask.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

EXIT

The Macro is executed if the main program is terminated, just before the Index Files are closed. If the variable EBUS_TRANSFER = 1 or EBUS_DATA = 0, the prorgam is not closed.

 

Attention: If within the ON EXIT MACRO functions or instructions are called, which are changing EBUS_TRANSFER or EBUS_DATA, EBUS_TRANSFER = 0 and EBUS_DATA = 1 has to be set at the of the macro if the program shall be terminated.

 

INDEXERROR

The Macro is executed if program control jumps to the block ON ERROR ... END due to an error with the following commands:

READ, READS

READ-NEXT, READS-NEXT

READ-PREVIOUS,READS-PREVIOUS

START, STARTS

DELETE

WRITE

 

The Macro is executed before the first instruction in the block ON ERROR ... END is executed.

 

The following variables then contain information about the current Index File access:

 

EBUS_FILENAME$(EBUS_FILENR) returns the Index File name.

 

EBUS_KEYNR returns the key number (0=primary key, 1 ... = secondary key).

 

EBUS_IFUNC returns the type of access:

 

1 = READ, READS

2 = START, STARTS

3 = READ-NEXT, READS-NEXT

4 = READ-PREVIOUS, READS-PREVIOUS

5 = DELETE

6 = WRITE

 

After the ON INDEXERROR Macro has been left the program continues with the first instruction in the block ON ERROR ... END.

 

KEY

The Macro is executed every time a character has been put into an alphanumeric mask field. The variable EBUS_KEY contains the ASCII value of the character and can be changed in the Macro. After the Macro has been executed the character shown by EBUS_KEY is transferred to the current input field if EBUS_KEY >0 and <256. In every other case the input is ignored.

 

Example:

/* Convert Ä into AE, do not allow Ö

ON KEY MACRO CONVERT

 

Macro CONVERT:

IF EBUS_KEY = ASC("Ä")

THEN EBUS_KEY = ASC("A")

     UNGETCHAR "E"

ENDIF

IF EBUS_KEY = ASC("Ö")

THEN EBUS_KEY = 0

ENDIF

 

The variable EBUS_TRANSFER is set to 0 before the Macro is called. If EBUS_TRANSFER is set to 1 in the Macro, the content of the variable EBUS_DATA is transferred to the current field. If EBUS_TRANSFER is set to a value <> 0, <> 99 and <> 1,  the content of the variable EBUS_DATA$ is transferred to the current field. In these cases neither the input character nor EBUS_KEY is processed.

 

Attention: This instruction has no effect with Html programs.

 

LBUTTONUP

The Macro is executed if the left mouse button is released again after it has been pressed.

 

The variables EBUS_MOUSE_ROW and EBUS_MOUSE_COL contain row and column of the mouse cursor.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the mask where the mouse cursor is.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

SYNCHRONIZE_MOUSE specifies whether MOUSE macros are synchronized.

 

LPRINT_LPRECORDER

The Macro is executed instead of the print if F1=print is executed in the print preview.

 

EBUS_LPRECORDER_FILE$ contains the file name of the temporary recorder file.

 

ON LPRINT_LPRECORDER has no effect with Html programs.

 

MENU

The Macro is executed every time a new menu item has been selected, also if the current menu item has been closed in the “normal“ way.

 

The variable EBUS_DATA can control whether the menu item is to be jumped to or not. Before the Macro is executed this variable is set to 1. If it is 0 after the Macro has been executed, the selected menu item is not called.

 

MESSAGE

The Macro is executed instead of the instructions MESSAGE and ERRORMES.

 

In the Macro the message type can be got by the variable MESSAGETYPE and the message itself by the variable MESSAGE$.

 

Within the Macro the instructions MESSAGE and ERRORMES are allowed. They are not diverted anymore. 

 

MOUSE

The Macro is executed if the left mouse button has been pressed.

 

The variables EBUS_MOUSE_ROW and EBUS_MOUSE_COL contain row and column of the mouse cursor.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the clicked mask.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

SYNCHRONIZE_MOUSE specifies whether MOUSE macros are synchronized.

 

MOUSEMOVE

The Macro is executed every time the mouse cursor is moved.

 

The variables EBUS_MOUSE_ROW and EBUS_MOUSE_COL contain row and column of the mouse cursor.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the mask where the mouse cursor is.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

The variable EBUS_OPTIMIZE_MOUSEMOVE specifies whether the ON MOUSEMOVE Macros are optimized.

 

RBUTTONUP

The Macro is executed if the right mouse button is released again after it has been pressed.

 

The variable EBUS_STANDARD_POPUP controls whether in mask fields the standard popup menu is displayed or the ON RBUTTONUP MACRO is executed.

 

The variables EBUS_MOUSE_ROW and EBUS_MOUSE_COL contain row and column of the mouse cursor.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the mask where the mouse cursor is.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

SYNCHRONIZE_MOUSE specifies whether MOUSE macros are synchronized.

 

READ(<INDEX FILE>)

The Macro is executed every time after a successful read access of the Index File <INDEXFILE>.

 

READ, READS,

START, STARTS,

READ-NEXT,

READ-PREVIOUS,

READS-NEXT,

READS-PREVIOUS

 

has been executed.

 

The Macro is also executed if e.g. a mask field that is linked with the Index File variable, is browsed with F3 or F4 or if the SELECT function is executed in this field.

 

READ_ALL

The Macro is executed every time after a successful read access of  any Index File.

 

RESIZE

The Macro is executed every time the size of the main window changes. The variable EBUS_MAINSIZE contains information about the size of the main window.

 

RMOUSE

The Macro is executed if the right mouse button is pressed.

 

The variable EBUS_STANDARD_POPUP controls whether in mask fields the standard popup menu is shown or the ON RMOUSE MACRO is executed.

 

The variables EBUS_MOUSE_ROW and EBUS_MOUSE_COL contains row and columns of the mouse cursor.

 

The variable EBUS_MOUSE_WDEPTH contains the window depth of the mask where the mouse cursor is.

 

The variable EBUS_MOUSE_IN_FIELD contains the internal field number of the mask field if a mask field has been clicked.

 

SYNCHRONIZE_MOUSE specifies whether MOUSE macros are synchronized.

 

SELECT

The Macro is executed every time a data record of an Index File has been read in a SELECT function. The Macro is executed before the data record is shown on screen. In this Macro the values of the Index File variables can be changed for the screen display.

 

The variable EBUS_SELECT can control whether the data record is displayed on screen or not. With EBUS_SELECT = 0 the display of the data record is suppressed after the Macro has been left, otherwise the data record is displayed. Every time before the Macro is executed EBUS_SELECT is set to 1.

 

If EBUS_SELECT is set to 99, the end of file is simulated, which means that the current data record is not displayed and no further data records are read. This can be used in order to restrict the number of data records to be read. 

 

With the variable EBUS_SELECT_COLOR$ the fields can be shown in color.

 

The ON SELECT MACRO is also executed with the instruction REFRESHSELECT for every read data record. However, the variable EBUS_SELECT and the instructions ENDSELECT and QUITSELECT have no effect.

 

SELECT(<Key>)

The Macro is executed every time the key <Key> has been pressed in SELECT, SELECTA or TREEVIEW.

 

The following keys are possible:

 

F1, F2,..., F24

SF1,…,SF12

PGUP, PGDN

CURSUP, CURSDN, CURSL, CURSR

SHIFT_CURSUP, SHIFT_CURSDN, SHIFT_CURSL, SHIFT_CURSR

SHIFT_PGUP, SHIFT_PGDN

SHIFT_INS, SHIFT_DEL

TABRIGHT, TABLEFT

RETURN

MOUSE

RMOUSE

RBUTTONUP

MOUSE_HEADER

RMOUSE_HEADER

RBUTTONUP_HEADER

INS, DEL

END

HOME

ESC

 

With the keys CURSUP, CURSDN, PGUP and PGDN the original effect is maintained, that means positioning and scrolling further forwards and backwards is possible with these keys. If the action has been successful (which means there has not been an attempt to scroll further at the beginning or the end), the respective Macro is executed after the highlight bar has been repositioned. 

 

The ON SELECT(MOUSE) Macro is executed in SELECT/SELECTA if the left mouse button is pressed and one or more of the keys SHIFT, ALT or Ctrl are being pressed at the same time.

 

The ON SELECT(RMOUSE) Macro is executed if the right mouse button is pressed.

 

The ON SELECT(RBUTTONUP) Macro is executed if the right mouse button is released again after it has been pressed.

 

The ON SELECT(MOUSE_HEADER) Macro is executed in SELECT/SELECTA if the left mouse button is pressed in a field of the header line.

 

The ON SELECT(RMOUSE_HEADER) Macro is executed if the right mouse button is pressed in a field of the header line.

 

The ON SELECT(RBUTTONUP_HEADER) Macro is executed if the right mouse button is released again in a field of the header line after it has been pressed.

 

SELECT(KEY)

The Macro is executed if in SELECT, SELECTA or TREEVIEW a key with an ASCII value from 1 to 255 (which means: no function keys) is pressed. The variable EBUS_SELECT_KEY the contains the ASCII value of the pressed key.

 

Attention: This instruction has no effect with Html programs.

 

SELECT_STARTED

The Macro is executed when the SELECT/SELECTA has started and has been displayed on the screen.

SET_FOCUS

The Macro is executed if a window is activated with SET_FOCUS.  EBUS_WDEPTH contains the window depth.

 

STDOUT

The Macro is executed if a line is written to the standard output of the program. EBUS_STDOUT$ contains the line.

 

TABCONTROL_CHANGE

The Macro is executed if a different file card is to be activated in the tab control.  The variable EBUS_DATA contains the number of the file card to be activated. EBUS_DATA$ contains the mask number. If in the Macro EBUS_TRANSFER is set = 1, the file card is not activated.

 

TIMER

TIMER2

TIMER3

TIMER4

TIMER5

TIMER6

TIMER7

TIMER8

TIMER9

TIMER10

TIMER11

TIMER12

TIMER13

TIMER14

TIMER15

TIMER16

16 timers can be defined.

 

The timer is executed every EBUS_TIMER_TIMEOUT milliseconds.

 

If the timeout interval of an already running timer is to be changed, the new interval value must be assigned to the variable EBUS_TIMER_TIMEOUT and the instruction ON TIMER MACRO must be executed again.

 

If the variable EBUS_TIMER_TIMEOUT has a value <= 0, the instruction ON TIMER MACRO does not have any effect.

 

For every execution of the ON TIMER MACRO a separate Thread is started. This allows the ON TIMER MACRO to be executed several times simultaneously. With ON TIMER RESET all currently running Macros of the timer are cancelled. This may lead to error reports.

 

If in the ON TIMER MACRO the instruction ON TIMER RESET is executed, the currently running Thread is not closed but only all other running Threads of this timer.

 

TREEVIEW_EDIT

The Macro is executed when an element of a TREEVIEW has been edited. EBUS_DATA contains the number of the element that has been edited and EBUS_DATA$ contains the number of the element that has been edited.

Attention: If the editing was finished by ESC EBUS_DATA$ contains the original text of the element.

 

WINDOW_ACTIVATE

The Macro is executed every time a window gains or loses the focus. EBUS_TRANSFER = 1 if the window gains the focus and it is = 0 if the window loses the focus.

 

EBUS_TRANSFER2 contains the window depth.

 

WRITE(<INDEX FILE>)

The Macro is executed every time a write access of the Index File <INDEX FILE> was carried out and no error occurred.

 

WRITE_ALL

The Macro is executed every time after a successful write operation of  any Index File.

 

The ON <Event> Macros are global with main and subprograms, which means they apply in the main program and all subprograms.

 

ON <Event> RESET disables an ON <Event> MACRO again.

 

With the ON SELECT(<Key>) Macros a <Helptext> can be defined. The effect is the same as with the ON <Key> Macros (see above).

 

Parameter:

Macroname

Name of macro

Helptext

[@<Iconname>,]<Text>

 

Sample:

ON F3 MACRO SEARCH,"@search.gif,Search Customer"

 

ON SELECT(F3)  MACRO ADDITIONAL.INFOS,"@add.jpg,Additional Informations"

 

See also:

GET_KEYSTATE