Client-side Events in Smart DevicesOfficial Content

Client events allow developers to add behavior and logic to the application mixing the execution between the client-side and server-side. As mentioned in Category :Smart Device Events?StartRefresh and Load are server events executed completely on the server, which means that they cannot use any of the resources of the device. In client events, we can mix the power of the server and the resources of our device.

Client-side events must use Composite command when trying to concatenate more than one action.

ClientStart event

ClientStart event is the first event executed on the device, even before executing Start event (server-side), without user interaction. Allows the developer to initialize the entry screen, e.g. UI, variables, etc.

Navigation.Start event

Navigation.Start event is executed immediately after ClientStart event, and allows the developer to initialize aspect related to navigation style (e.g. call the main panel when the application has Slide navigation).

Back event

Back event allows the developer to capture when the end-user press back button on Android or do a back gesture on iOS.

Control and user events

These events are the programmatic response of the application to user interaction. These forms of interaction are called actions and can be seen in on-screen buttons, images, or other controls that when tapped, long tapped, etc., will execute the event associated to the action. Also, exists other predefined events that are executed in special cases or without any user interaction.

Mainly we have two types of events: user  and control events. Both are associated with controls. The slight difference is while the former has a name given by the developer and then associated to the controls themselves (with the tap gesture as the way to trigger them); the latter are automatically predefined, depending on control type, having, in the case of touch control events, the event itself as the way to trigger them (e.g. control.LongTap event). Other kinds of control events are, for example, control.PageChanged event (when control is a grid of certain control type), or control.ControlValueChanged event (when control is a readOnly attribute or variable).

What happens when the end user triggers an action? The associated code is executed on the client-side (i.e. 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 by the Refresh command).

In this event, the developer is allowed to:

  • Call Rest Web Services:
  • Call a WorkWith
     
    • Edit 
      Call a Work With for Smart Devices Detail node in order to Insert, Update or Delete information:
      • WorkWithDevicesObject.levelname.Detail.Delete( primaryKey )
      • WorkWithDevicesObject.levelname.Detail.Update( primaryKey )
      • WorkWithDevicesObject.levelname.Detail.Insert( &bc )
         
    • View 
      Call a Work With for Smart Devices List or Detail:
      • WorkWithDevicesObject.levelname.Detail( primaryKey )
      • WorkWithDevicesObject.levelname.List( )
         
  • Call a Panel for Smart Devices?
     
  • Call a Menu for Smart Devices?
     
  • Invoke the external objects of the Smart Devices API.
    For example,
    • Msg(&var)
    • Confirm (&var)
    • Return
    • Refresh
    • AddressBook.AddContact( ... )
    • etc.
       
  • Call a Panel for Web by means of the Component Domain.
    This action displays a web page by the web navigator,  loading the web panel without showing navigator's frame. That can be recovered if the user wishes to do so.
     
  • Call to Subroutines.
     
  • Commands:
     
    • Control properties assignments depending on the control.
      When the developer enters the control name followed by a dot ("."), an intellitip is opened showing all possibilities for this control.
      For example,
      • Control.visible = ...
      • Control.class = ...
         
    • Simple variable assignment.
      For exmaple,
      • &Var = "Test" 
      • &Var = 123
      • &Var = proc.Udp()
         
    • Use SDT or BC based variables element assignation.
      For example,
      • &Var = &SDT.Field 
      • &BC.item = ...
         
    • Execute For Each Line and selected line commands in grids with multiple selections.
       
    • Use If-Else-EndIf, Do-Case and Do-While code blocks.
      Cannot use complex expressions on the conditions such as calling Procedures or External Objects methods; only simple conditions are allowed using variables, attributes or SDT members, and involving operators and standard functions.
       

Videos

Start Video Work With for Smart Devices – Behavior through Events
Start Video Events in Smart Devices

See also



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.