CALLBACK Verb - Register BBj Subroutine
Syntax
CALLBACK (eventType,subroutineName,contextID,{controlID})
or
CALLBACK (eventType,publicProgramEntryPoint,contextID,{controlID})
Description
A CALLBACK is used to execute a block of code at a given location when a specific event occurs. In some cases, this is tied to a specific control via the controlID.
The CALLBACK verb will implicitly GOSUB to the subroutine specified in subroutineName. Since the block of code executed at subroutineName is arrived at via an implicit GOSUB, a RETURN is required at the end of the subroutine.
The CALLBACK implicitly CALLs the publicProgram at the given EntryPoint when the CALLBACK VERB uses the publicProgramEntryPoint syntax (ie: "publicProgram::EntryPoint"). Since a CALL has been made to a public program, an ENTER may optionally be used at the beginning, and a EXIT is required at the end.
CALLBACKS must be registered before the PROCESS_EVENTS verb or within
a SUBROUTINE that is called in response to an event.
The REMOVE_CALLBACK
verb removes event handling for the eventType
(specified event for a control).
For more information, see PROCESS_EVENTS.
Parameter |
Description |
---|---|
eventType |
An event type as seen in the table below. |
subroutineName |
A name of a subroutine that starts with and Alpha character and contains any number of alpha, numeric, and underscore characters. |
contextID |
An integer value between 0 and 32767. |
controlID |
Control ID number, which must be an integer between 1 and 32767 and unique within a given top-level window. Optional for window events. |
publicProgramEntryPoint |
A string of the form "publicProgramName::entryPoint". This parameter must be a BBj string expression:
CALLBACK(ON_BUTTON_PUSH,"foo::bar",0,101) And so is this: SUB$="foo::bar" CALLBACK(ON_BUTTON_PUSH,SUB$,0,101) But this is a syntax error: CALLBACK(ON_BUTTON_PUSH,foo::bar,0,101) |
Window Events
Callback Syntax | Event | Code |
---|---|---|
ON_ACTIVATE |
A | |
ON_CLICK | Mouse Click | k |
ON_CLOSE |
X | |
ON_COLOR_CHANGE |
s | |
ON_DEACTIVATE |
A | |
ON_DOUBLE_CLICK |
2 | |
ON_KEYPRESS |
t | |
ON_MDI_CLOSING |
M | |
ON_MINIMIZE |
A | |
ON_MOUSE_DOWN |
d | |
ON_MOUSE_ENTER |
Mouse Enter/Exit Event | E |
ON_MOUSE_EXIT |
Mouse Enter/Exit Event | E |
ON_MOUSE_MOVE |
m | |
ON_MOUSE_SCROLL |
Mouse Scroll Wheel | w |
ON_MOUSE_UP |
u | |
ON_RESIZE |
S | |
ON_RESTORE |
A | |
ON_SCREEN_RESIZE |
s | |
ON_WINDOW_GAINED_FOCUS |
F | |
ON_WINDOW_LOST_FOCUS |
F | |
ON_WINDOW_MOVE |
L | |
ON_WINDOW_SCROLL |
p |
Menu Events
Callback Syntax |
Event |
Code |
---|---|---|
ON_MENU_ITEM_SELECT |
C |
Popup Menu Events
Callback Syntax |
Event |
Code |
---|---|---|
ON_POPUP_ITEM_SELECT |
r |
Control Events
Callback Syntax |
Event |
Code |
---|---|---|
ON_BUTTON_PUSH |
B |
|
ON_CELL_SELECTION_CHANGE (BBj 19.20 and higher) |
CELLSELECTCHANGE Grid Notify Event | N (Notify code 43) |
ON_CHECK_CHANGE (BBj 23.00 and higher) |
Check/Uncheck Event | c |
ON_CHECK_OFF |
c |
|
ON_CHECK_ON |
c |
|
ON_COLORCHOOSER_APPROVE |
||
ON_COLORCHOOSER_CANCEL |
||
ON_COLORCHOOSER_CHANGE |
||
ON_COLUMN_SELECTION_CHANGE | COLSELECTCHANGE Grid Notify Event | N (Notify code 41) |
ON_CONTROL_SCROLL |
p |
|
ON_CONTROL_VALIDATION |
v | |
ON_DB_GRID_ROW_CHANGE_REQUEST (BBj 7.00 and higher) |
N/A |
|
ON_DEFINED (BBj 24.00 and higher) |
Web Component Defined Event | x |
ON_DRAG_SOURCE_DROP |
O |
|
ON_DROP_TARGET_DROP |
D | |
ON_EDIT_KEYPRESS |
N (Notify code 1) |
|
ON_EDIT_MODIFY |
e |
|
ON_EXECUTE_SCRIPT (BBj 19.10 and higher) |
Execute Script Event | x |
ON_FILECHOOSER_APPROVE |
FileChooser Approve Event | x |
ON_FILECHOOSER_CANCEL |
x | |
ON_FILECHOOSER_CHANGE |
x | |
ON_FILECHOOSER_FILTER |
FileChooser Filter Event | x |
ON_FONTCHOOSER_APPROVE |
x | |
ON_FONTCHOOSER_CANCEL |
x | |
ON_FONTCHOOSER_CHANGE |
x | |
ON_FORM_VALIDATION |
V |
|
ON_GAINED_FOCUS |
f |
|
ON_GRID_CELL_MODIFY |
N (Notify code 5) |
|
ON_GRID_CELL_QUERY |
N (Notify code 33) |
|
ON_GRID_CELL_VALIDATION |
N (Notify code 32) |
|
ON_GRID_CHECK_OFF |
N (Notify code 30) |
|
ON_GRID_CHECK_ON |
N (Notify code 30) |
|
ON_GRID_COLUMN_SIZE |
N (Notify code 1) |
|
ON_GRID_DOUBLE_CLICK |
N (Notify code 3) |
|
ON_GRID_DRAG_DROP |
N (Notify code 4) |
|
ON_GRID_EDIT_START |
N (Notify code 8) |
|
ON_GRID_EDIT_STOP |
N (Notify code 7) |
|
ON_GRID_ENTER_KEY |
N (Notify code 9) |
|
ON_GRID_ERROR |
N (Notify code 29) |
|
ON_GRID_GAINED_FOCUS |
N (Notify code 20) |
|
ON_GRID_HIT_BOTTOM |
N (Notify code 10) |
|
ON_GRID_HIT_TOP |
N (Notify code 11) |
|
ON_GRID_KEYPRESS |
N (Notify code 12) |
|
ON_GRID_LEFT_COLUMN_CHANGE |
N (Notify code 16) |
|
ON_GRID_LIST_CANCEL |
N (Notify code 34) |
|
ON_GRID_LIST_CHANGE |
N (Notify code 35) |
|
ON_GRID_LIST_CLICK |
N (Notify code 36) |
|
ON_GRID_LIST_CLOSE |
N (Notify code 37) |
|
ON_GRID_LIST_OPEN |
N (Notify code 38) |
|
ON_GRID_LIST_SELECT |
N (Notify code 39) |
|
ON_GRID_LOST_FOCUS |
N (Notify code 13) |
|
ON_GRID_MOUSE_DOWN |
N (Notify code 14) N (Notify code 15) |
|
ON_GRID_MOUSE_DRAG |
N (Notify code 17) |
|
ON_GRID_MOUSE_MOVE |
N (Notify code 17) |
|
ON_GRID_MOUSE_UP |
N (Notify code 14) |
|
ON_GRID_RIGHT_MOUSE_DOWN |
N (Notify code 18) |
|
ON_GRID_RIGHT_MOUSE_UP |
N (Notify code 18) |
|
ON_GRID_ROW_DELETE |
N (Notify code 25) |
|
ON_GRID_ROW_INSERT |
N (Notify code 24) |
|
ON_GRID_ROW_INSERT_CANCEL |
N (Notify code 26) |
|
ON_GRID_ROW_UPDATE |
N (Notify code 27) |
|
ON_GRID_ROW_VALIDATION |
ROWVALIDATION Notify Event |
N (Notify code 31) |
ON_GRID_SELECT_CELL | CELLCHANGE Grid Notify Event | N (Notify code 42) |
ON_GRID_SELECT_COLUMN |
N (Notify code 2) |
|
ON_GRID_SELECT_ROW |
N (Notify code 19) |
|
ON_GRID_SPECIAL_KEY |
N (Notify code 6) |
|
ON_GRID_TOP_ROW_CHANGE |
N (Notify code 21) |
|
ON_GRID_UPDATE |
N (Notify code 22) |
|
ON_HYPERLINK_ACTIVATE |
x | |
ON_HYPERLINK_ENTER |
x | |
ON_HYPERLINK_EXIT |
x | |
ON_INPUT_KEYPRESS |
N (Notify Code 1) |
|
ON_LIST_CANCEL |
N (Notify code 4) |
|
ON_LIST_CHANGE |
N (Notify code 5) |
|
ON_LIST_CLICK |
l (lower case L) |
|
ON_LIST_CLOSE |
N (Notify code 3) |
|
ON_LIST_DOUBLE_CLICK |
l (lower case L) |
|
ON_LIST_OPEN |
N (Notify code 1) |
|
ON_LIST_SELECT |
N (Notify code 2) |
|
ON_LOST_FOCUS |
f |
|
ON_MOUSE_ENTER |
E |
|
ON_MOUSE_EXIT |
E |
|
ON_NATIVE_JAVASCRIPT | Native JavaScript Event | x |
ON_NAV_FIRST |
N (Notify code 1) |
|
ON_NAV_LAST |
N (Notify code 1) |
|
ON_NAV_NEXT |
N (Notify code 1) |
|
ON_NAV_PREVIOUS |
N (Notify code 1) |
|
ON_PAGE_LOADED |
||
ON_POPUP_REQUEST |
p |
|
ON_RIGHT_MOUSE_DOWN (BBj 2.01 and higher) |
Right Mouse Button Down Event | R |
ON_ROW_SELECTION_CHANGE (BBj 19.20 and higher) |
ROWSELECTIONCHANGE Grid Notify Event | N (Notify code 40) |
ON_SCRIPT_FAILED (BBj 19.20 and higher) |
Script Failed Event | x |
ON_SCRIPT_LOADED (BBj 19.20 and higher) |
Script Loaded Event | x |
ON_SELECTION_CHANGE | Radio Group Selection Change Event | g |
ON_SPIN |
N/A |
|
ON_STATE_CHANGE (BBj 21.10 and higher) |
State Change Event | x |
ON_TAB_CLOSE (BBj 16.00 and higher) |
Tab Close Notify Event | N (Notify code 4) |
ON_TAB_DESELECT |
N (Notify code 3) |
|
ON_TAB_KEYPRESS |
N (Notify code 1) |
|
ON_TAB_POPUP (BBj 16.00 and higher) |
Tab Popup Notify Event | N (Notify code 5) |
ON_TAB_SELECT |
N (Notify code 2) |
|
ON_TOOL_BUTTON_PUSH |
b |
|
ON_TREE_COLLAPSE |
N (Notify Code 4) |
|
ON_TREE_DESELECT |
N (Notify Code 2) |
|
ON_TREE_DOUBLE_CLICK |
N (Notify Code 7) |
|
ON_TREE_EDIT_STOP |
N (Notify Code 5) |
|
ON_TREE_EXPAND |
N (Notify Code 3) |
|
ON_TREE_MOUSE_DOWN |
N (Notify Code 6) |
|
ON_TREE_MOUSE_UP |
N (Notify Code 6) |
|
ON_TREE_RIGHT_MOUSE_DOWN |
N (Notify Code 8) |
|
ON_TREE_RIGHT_MOUSE_UP |
N (Notify Code 8) |
|
ON_TREE_SELECT |
N (Notify Code 1) |
|
ON_WEB_EVENT (BBj 24.00 and higher) |
Web Event | x |
Other Events
Callback Syntax |
Event |
Code |
---|---|---|
ON_BROWSER_BACK (BBj 16.00 and higher) |
BBjBrowserBackEvent | Z |
ON_BROWSER_CLOSE (BBj 21.02 and higher) |
BBjBrowserCloseEvent | Z |
ON_GEOLOCATION_POSITION |
BBjGeolocationEvent |
G |
ON_GEOLOCATION_WATCH |
BBjGeolocationEvent |
G |
ON_LINK_FAILED (BBj 22.03 and higher) |
BBjLinkFailedEvent | NA |
ON_LINK_LOADED (BBj 22.03 and higher) |
BBjLinkLoadedEvent | NA |
ON_NAMESPACE_CHANGE (BBj 6.00 and higher) |
BBjNamespaceEvent |
N (Notify Code 1) for set. N (Notify Code 2 for change. |
ON_TIMER (BBj 6.00 and higher) |
Timer Event |
T |
ON_WEB_CONNECTION (BBj 12.00 and higher) |
BBjServletEvent |
Example
|