#Events

This is a comprehensive guide to SIMPOL events, I will outline the various event types, what’s required to use them in your programs and give a few examples of when these may come in handy.

Some of these events come up multiple times in varying libraries the grouping here is arbritary, simply search for the event name

  1. What are events in SIMPOL?
    a. Event Handling 101
    b. Eventhandler functions
  2. General Events
  3. Grid Events
  4. Form and Record events

What are events in SIMPOL

Before diving in depth on SIMPOL’s event handling it may be useful to know what an event is, according to the ever trustworthy Wikipedia:

an event is an action or occurrence recognized by software, often originating asynchronously from the external environment, that may be handled by the software…

Event (computing) – Wikipedia 2019 (link)

Events are used throughout SIMPOL programs to provide functionality based on a user’s input, whether that be a mouse click, switching records, or closing the entire program. You may have already come across events before in previous tutorials, for for example in our Advanced I/O Tutorial we added several button onclick functions

SIMPOL has a lot of events that can be handled, and each control uses a unique subset of them. The exact events that any control has are all listed in that controls respective Properties table in the Language Reference Manual.

Event Handling 101

To use an events we have to declare an event handling function to which that input is passed: if you’re using a form created in Superbase NG Personal this is done in the events panel of any controls properties (see below)

Alternatively if you are creating the form in the IDE all you have to do is set that controls event function to the function you wish to handle the request. This sounds complicated but for the above example the following code is required

formcontrolvariable.onclick.function =@ okbtn_oc

Alternatively using the member operator (!) we can from the form select the button and assign the function that way:

formvariable!bOK.onclick.function =@ okbtn_oc

NOTE: This is also how you would assign a reference to the object (typically this will be an appwindow object or a form object)

Once this is done all you have to do is declare the event handler function you have named, that’s what the next section is for

Handling Functions

The main purpose of this page is to show you exactly which variables are needed when declaring an eventhandler, this list of variables can vary from the standard control variable plus the optional reference to upwards of 4 or 5 additional variables for some

Declaring event handling functions is the same as declaring any other function: function keyword, a list variables in brackets, the main code and then end function. Just make sure that the function name and control type match up with the control declaration

Pages: 1 2 3 4