SOB – Callbacks

There are some interactions between the user’s keyboard (and/or mouse) and the executable’s GUI,  that can trigger an event that can, if wanted, cause a user defined function to be called.

Such interactions are called events, and the function that handles the event is called a callback.

This executable supports three types of events:

1) A mouse click occurs on a SOB.

  1. a PRESS or CLICK event- The mouse click, typically the left mouse button, is used to indicate the activation of a button/label/image
  2. a SELECTION or SELECT event- The mouse click, typically the left mouse button, is used to indicate the selection of an item from a set of items. Used by ListView and combo SOBs.
  3. MOUSECLICK event – A mouseclick action occurs on a SOB and that action does not trigger a PRESS / CLICK / SELECTION/ SELECT event.
  4. CHANGE event – a slider bar is moved or the slider’s up/down arrows is clicked.

2) A keyboard stroke occurs in a text input field of a SOB. This category has 3 variants:

  1. EDIT event- A user defined event is triggered before the default event handling.
  2. EDITED event – A user defined event is triggered after the default event handling.
  3. ENTER event – A special case that handles a user supplied Enter key press, or the Carriage Return key press.

3) A drag’n’drop drop event occurs when the left mouse button is released over a drop enabled SOB. This category has 2 variants:

  1. DROP TEXT – The drop operation is treated as a supplier of a text string.
  2. DROP FILE – The drop operation is treated as a supplier of a file name.

Relevant demos at the menu option Help / sub-section Screen Object  -Demos .

  • Colour Mixing– uses three sliders to mix red, blue and green values.  Uses  the CHANGE callback.
  • Combo Boxes– uses three different combo boxes.  Uses  the CLICK, SELECTION, EDIT and ENTER callback.
  • Drop Catcher– catches dropped text, and dropped files.  Uses  the DROP.TEXT and DROP.FILE callback.
  • ListView – Creates and populates a multi-line, multi-column listview, where you can control the column widths by a slider. Uses the CLICK, CHANGE, SELECT, EDIT and  MOUSECLICKS callbacks.
  • Password – create an edit field that when you enter text only shows *’s but the SOB holds the entered text correctly. Uses both the EDIT and EDITED callbacks.

Event name: PRESS
Trigger: when the user left clicks with the mouse on a SOB
Users: Buttons, Labels, menu items
Function prototype: function myFunction ( sobid )
‘ SOBID is the identity of the SOB that generated the event
Return value: will be ignored

Event name: EDIT
Trigger:  when the user changes a editable field.
Triggered before edit is accepted
Users: Edit , edit.multi , combo.edit , combo.dropdown , combo.dropdown
Function prototype: function myFunction ( sobid , editCharAsValue )
‘ SOBID is the identity of the SOB that generated the event
‘ EDITCHAR the character, provided as value !
Return value: none, the edit will continue
-1 will cause the edit to be discarded
else the returned value will replace the original editChar

Event name: EDITED
Trigger:  after the user changes a editable field.
Users: Edit fields , combo boxes
Function prototype: function myFunction ( sobid , editCharAsInteger )
‘ SOBID is the identity of the SOB that generated the event
‘ editCharAsInteger the character, provided as an integer
Return value: none, the edit will continue
-1 will cause the edit to be discarded
else the returned character will replace the original editChar

Event name: ENTER
Trigger:
Users:
Function prototype: function myFunction ( sobid , editCharAsInteger )
‘ SOBID is the identity of the SOB that generated the event
‘ editCharAsInteger the character, provided as an integer
Return value: none


Event name: CHANGE
Trigger: When a slider is moved, or when one of a slider’s up/down arrows is clicked.
Users: SLIDERS
Function prototype: function myFunction ( sobid , <NEW VALUE: integer expression> )
‘ SOBID is the identity of the SOB that generated the event
‘ NEW VALUE the new value addociated with the SOB
Return value: none

Event name: DROP TEXT
Trigger:
Users:
Function prototype: function myFunction ( sobid )
Return value: none

Event name: DROP FILE
Trigger:
Users:
Function prototype: function myFunction ( sobid )
Return value: none

Event name: MOUSECLICKS
Trigger:
Function prototype: function myFunction ( sobid, <ClickType: integer expression> )
‘ SOBID is the identity of the SOB that generated the event
‘ CLICKTYPE: Double Left = 0 Double Right = 6 Single Right = 7
‘ only applicable to LISTVIEWs
Return value: will be ignored

 

Event name: SELECT
Trigger:
Function prototype: function myFunction ( sobid, selectedRowId, columnId )
‘ SOBID is the identity of the SOB that generated the event
‘ SELECTEDROWID is the 1-based index of the item selected within the SOB
‘ COLUMNID is the 1-based index of the column where the mouse was clicked
‘ only applicable to LISTVIEWs and COMBO BOXes
Return value: will be ignored