0

Developing Smart Devices in Genexus. I am using the Load Event to load some hundreds of records (returned by a 3rd party webService) into the Grid (some rows might have different layouts).

When the user hits the search button, a ProgressIndicator is immediately shown (during the procedure execution). When the procedure ends (data retrieved), the ProgressIndicator disappears but it may take an additional 4-5 seconds for the Grid to show the fresh data.

This causes the user to think that there was a problem with the search. Then, unexpectedly, the grid refreshes.

Is it possible to, somehow, show a ProgressIndication during the Load or Refresh Events? Or do you have any suggestions to prevent this behavior?

Jaime
  • 159
  • 2
  • 10

1 Answers1

1

The main issue is that Refresh and Load events are "server" events in SD architecture so you don't have access to the device's APIs or resources like the Progress Indicator.

We had the same requirement in iOS and what we did was using the GXRefresh event.

Event 'gxrefresh'
   Composite
      //Your code. Example: ProgressIndicator.Hide()
   EndComposite
EndEvent

Gxrefresh is a Local event that is executed after the Refresh and Load. Is a hidden event that helped us accomplish this. (This is not an official event and it can be taken out in any version of GeneXus) So the solution is:

  • Start a Progress Indicator on the ClientStart event of that Panel.
  • Hide the Progress Indicator on the 'gxrefresh' event of that panel.

Note: Remember that in order to use the gxrefresh event you will need to add a hidden button named 'gxrefresh'. You can hide that button as you will not need it in the UI (we put it Visible=false on the application bar).

If that solution for any reason is not possible (for example the gxrefresh event is deprecated or you are developing for Android) I can think of a second WA that is not elegant at all but should work.

  • Start the Progress Indicator in the Client Start Event of the panel
  • Put a hidden variable with control type SD Chronometer.
  • Set the timer for 6 seconds
  • Stop the Progress Indicator on the Tick event of the SD Chronometer and stop the Chronometer so the Tick event is not executed any more.

These are the two options I can think of. Maybe there is an easier way but I haven't heard of it. A Grid.DidLoad event would be great for this scenario. For sure we will have this soon or some other solution for this problem.

Links:

SD Chronometer: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?25058

SD Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?17042

Server Side Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?24234

Franklin
  • 881
  • 1
  • 8
  • 28
  • Hello. Thanks for your feedback, it was very instructive. So, my Event 'search' starts with the instruction "ProgressIndicator.ShowWithTitleAndDescription('MyApp','Please wait...')", then the procedure is called. However it seems that the ProgressIndicator automatically hides at the endEvent line, even if I omit the instruction "ProgressIndicator.Hide()". Therefore, when the next SDEvent comes (gxrefresh or chronometer.tick) the progress indicator is already hidden. Is there anything else I could try? – Jaime Jan 21 '15 at 10:17
  • That is true, the progress indicator gets hidden automatically after an End Event. Do you execute a Refresh on your Search Event? – Franklin Jan 21 '15 at 19:05
  • Yes, right after the search event (to refresh the data on the grid). – Jaime Jan 22 '15 at 11:58