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 )
return;
// 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
Paul