Log In    |    Knowledge Base    |    4D Home
Tech Tip: Quick loading screen for View Pro area
PRODUCT: 4D View Pro | VERSION: 19 | PLATFORM: Mac & Win
Published On: July 3, 2023

When presenting data in a 4D View Pro area to a user, in certain scenarios, it may take a moment for the data to load and display. For example, if there are some charts that need to be built from a ton of data, it will probably take a while for the View Pro Area to load. In these cases, adding a loading screen may be prudent to improve the user experience.

To implement a simple loading screen, in the form editor, first, place a Text object that says something like “Loading…” over the View Pro area. Then, in the “On Load” event of the form method, use OBJECT SET VISIBLE to hide the View Pro area.

Case of
   : (Form event code=On Load)
   OBJECT SET VISIBLE(*; "ViewProArea"; False)
End case

Finally, in the “On VP Ready” event of the View Pro area object method, at the end, use OBJECT SET VISIBLE again to reveal the View Pro area and to hide the loading text.

Case of
   : (Form event code=On VP Ready)
   // some code to prep & load the View Pro chart
   // . . .
   // disable loading screen
   OBJECT SET VISIBLE(*; "ViewProArea"; True)
   OBJECT SET VISIBLE(*; "Text"; False)
End case

Now, the user can see a loading screen before the contents of the View Pro area is displayed.