Canvas Apps Performance

How to get rid of cross screen dependencies

Two screens / monitors

Introduction - Cross screen dependencies

Cross screen dependencies exist when a control on one screen has a property that is dependent on (or references) a control on another screen. It becomes a problem because for one screen to load, the other screen also needs to be loaded in the memory.

Cross screen dependency - Example 1

Follow these steps to set up an example that shows what a cross screen dependency is:

  1. Add two labels on Screen 1 - Label 1 and Label 2
  2. Set X property of Label 1 to 20
  3. Set X property of Label 2 to Label1.X + Label1.Width + 20

A lot of times, makers copy and paste controls. Copy Label1 and paste it on Screen2 (Label1_1). Copy Label2 and paste it on Screen 2. Now you have Label2_1 with its X property set to Label1.X + Label1.Width + 20.

The control Label2_1 (on Screen 2) is now dependent on Label1 (on Screen 1). The fix is to simply set the X property of Label2_1 to Label1_1.X + Label1_1.Width + 20.

That way, Label 2 is dependent on Label 1 (both on Screen 1) and Label2_1 is dependent on Label1_1 (both on Screen 2).

Cross screen dependency - Example 2

Follow these steps to set up another example that shows what a cross screen dependency is:

  1. Add a gallery of Users on Screen 1 and name it galUsers
  2. Add a label on Screen 2 and set its Text property to galUsers.Selected.'Full Name'
  3. Set the OnSelect of galUsers to Navigate('Screen 2')

The label on Screen 2 is now dependent on the gallery on Screen 1. The fix is to change the OnSelect of galUsers to:

UpdateContext({locSelectedUser: ThisItem}); Navigate('Screen 2')

And then to set the Text property of the label on Screen 2 to: locSelectedUser.'Full Name'

Recent articles

  1. Optimize data calls inside a gallery
  2. How to make concurrent multiple unrelated data calls
  3. How to optimize fetching multiple records from a table

2 thoughts on “How to get rid of cross screen dependencies”

Leave a Reply