Usersystem events have their own triggering order, according to each event and the instructions that compose them. System events such as Start, Refresh and Load are always executed on the server, and user events are usually executed on the client unless a round trip to the server is required. For example:
Here we have a user event corresponding to an action on the form, the Message button. It is made up of a single instruction that doesn't require server services.
However, in the example below access to the server is required because the call to a procedure is always executed there.
Regardless of the above, basically the event triggering sequence in a panel (either Work With for SD List or Panel for Smart Devices object) is as mentioned when we studied Smart Device Events:
ClientStart (List) //since Xev3 version
Load (if there is any non SDT-based grid on the layout)
If the panel corresponds to the Work With for SD detail with n sections, the events will be triggered as follows: First, Detail system events will be triggered (i.e. Start, Refresh and Load events associated to the Detail node of the WWSD). After that, depending on the sections:
- If the sections are displayed as Tabs, each section is activated when the tab is first selected (or at startup for the first tab). So, its system events are triggered. After navigating the tab you can select it again but none of the System Events will be executed for that section (since it is already "online"). If you exit the containing object and press back this will execute all the System Event tabs again.
- If the sections are displayed as Links, each section is activated (and so system events are triggered) when the link is executed.
- If the sections are displayed Inline, each section is activated in an indeterminate (and possibly concurrent) order.
- When invoking a BC in insert, update or Delete mode (WWSD.Detail.Insert() / WWSD.Detail.Update(pk) / WWSD.Detail.Delete(pk)), this won't execute neither the Start nor the Refresh event (the default rules for the BC itself will be applied instead). However, the Detail Start event will be executed.
Schematically, that is:
ClientStart (Detail) //since Xev3 version
Load (Detail, if there is any non SDT-based grid)
ClientStart (Section 1) //since Xev3 version
Start (Section 1)
Refresh (Section 1)
Load (Section 1, if there is any non SDT-based grid)
ClientStart (Section n) //since Xev3 version
Start (Section n)
Refresh (Section n)
Load (Section n, if there is any non SDT-based grid)
executing the Section m ClientStart-Start-Refresh-Load sequence under the above considerations.
After loading the screen, user is ready to interact. What happens when the user triggers an action (client event)? The associated code is executed in the client side, that is, in the device, unless a roundtrip to the server is required (for example, when a procedure must be invoked). In any case, system events are not executed (unless they are explicitly required through the Refresh command).
Depending on the caching settings it is decided whether the device should go and retrieve data from the server.
After going to the server, if there are no changes in the server data, nothing is brought back to the client. Otherwise, the Refresh and Load (if there is a non SDT-based grid) events are executed.
What if the Refresh command is executed on a client event of a Detail section? The system events for the Detail node will be executed, as well as the sections that were previously activated (except for those Inline, that will be activated at any time, as mentioned above).
Smart Device Events
Server-side Events in Smart Devices