in GUI Development by
Dear all,

I realized a GUI that is composed by three different screens that I can slide from right to left. In the first screen, control panel sends some requests to the device connected to update the state of an object. When the user changes screen, that object is not more visible, so control panel has to stop to send that request since it doesn't need that kind of information. How can I achieve this? In particular I need to know which are the events that I can use when I enter and exit from a screen. In this way I can, for example, start and stop a timer to send a request to the connected device in order to update the state of objects present on that screen.

Waiting for you kind reply

Thanks in advance

Best regards


2 Answers

+1 vote

Dear Gianni,

I assume, you have arranged 3 screens within an Outline Box and you use a 'Slide Touch Handler' to scroll them. In such case:

- You can assign a slot method to the property 'OnEnd' of the 'Slide Touch Handler'. The method is executed every time the 'Slide Touch Handler' has finished the scroll animation.

- Within the slot method you evaluate the current value of the property 'ScrollOffset' of the 'Outline Box'. Accordingly you can determine which screen is currently visible:

// Assuming all screens and the 'Outline Box' have the same width, calculate from
// the current ScrollOffset the number of the screen (0, 1, 2, ...).
var int32 screenNo = ( Outline.ScrollOffset.x / -Outline.Bounds.w );

- Additionally you can manage within your component or application a variable identifying the latest active screen (e.g. 'CurrentScreenNo'). By evaluating this variable in the slot method you can detect when the user has switched the screens:

var int32 screenNo = ( Outline.ScrollOffset.x / -Outline.Bounds.w );

// The screen has not changed
if ( screenNo == CurrentScreenNo )

// The user has switched between the screen. Deactivate the events, etc.
// used within the previously used screen
switch ( CurrentScreenNo )
  case 0 : TheScreenComponent1.DeactivateTheScreen();
  case 1 : TheScreenComponent2.DeactivateTheScreen();
  case 2 : TheScreenComponent3.DeactivateTheScreen();
  default :;

// From now another screen is active. Remember ist number
CurrentScreenNo = screenNo;

// And advise it to start with event, etc. processing
switch ( CurrentScreenNo )
  case 0 : TheScreenComponent1.ActivateTheScreen();
  case 1 : TheScreenComponent2.ActivateTheScreen();
  case 2 : TheScreenComponent3.ActivateTheScreen();
  default :;

- Within your screen components implement the methods 'DeactivateTheScreen' and 'ActivateTheScreen'. The methods should disable/enable the timers, or system event handler (if these are used), etc.

Does it help you?

Best regards


+1 vote
you could remember the current visible screen reference into a global (Core::Group) CurrentScreen-property. The property could notify observers that are attached to it. As long as this CurrentScreen-property refers to your "control panel", the requestes has to be sent. Otherwise it should stop (when the observers notify, that the current screen has changed).

But, how can I get the current Screen? One solution for this may be your "slider" and its offset. Bind a slot on the sliders onAnimate and check the offset. If it is between 0 and e.g. 500, then CurrentScreen = ControlPanel;, if between e.g. 500 and e.g. 1000 CurrentScreen = ... aso.

I guess there are more ways to do this. But this way should be one of the simplest ;-)

Best regards,

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint