You are here: Web Apps with Visual LANSA > 14. Widgets and 3rd Party Integration > 14.6 LANSA Mobile Application Widgets > 14.6.1 Widget Initialization (Important code recommendation)

14.6.1 Widget Initialization (Important code recommendation)

When an LMA widget is instantiated in RDML, the widget asynchronously performs an initialization procedure that will allow it to interact with the device's features. No methods in the widget should be called prior to receiving the widget's Initialize event. It is recommended that any control on a web page, that when clicked or selected results in the execution of a widget's method, should be disabled when the web page is loaded. The control should be enabled when the widgets initialize event is received.

Define_Com Class(#xDeviceAudioPlayback) Name(#AudioPlayback)

Evtroutine Handling(#COM_OWNER.Initialize)
  #PlayButton.Enabled := false
  #StopButton.Enabled := false
Endroutine

Evtroutine Handling(#AudioPlayback.Initialize)
  #PlayButton.Enabled := true
  #StopButton.Enabled := true
Endroutine