129 views
in GUI Development by
This is a complicated scenario we face in our embedded wizard codebase (and stuck because of this issue). I will try to explain with an example scenario for easy understanding.

- In the Application view, we added a button. Upon clicking it, we "PresentDialog Screen1".

- Screen1 contains a button, upon clicking it, we "SwitchToDialog Screen2".

- In Application view, we have a timer for say 15 seconds. In the timer slot, we "PresentDialog Screen3".

 

The problem scenario is like, when the Application starts, we click the button, so that Screen 1 is presented.

Then we touch and hold the button on the Screen1. We do not release the touch until the timer is activated and Screen3 is presented.

When timer in the Application is activated and Screen3 is presented, we release the touch. Even though the button is in Screen1 and currently presented view is Screen3, the release slot of the button is triggered and screen switching from Screen1 to Screen2 happens. This results in the disappearing of Screen3.

 

This situation occurs because user touch and hold the button until next screen is displayed on top. When he releases the touch, the button release event is triggered on the currently behind screen (which actually should not happen as its not the active screen anymore).

 

I have a sample codebase explaining this scenario, but I do not know how to attach the zip folder in this forum.

1 Answer

0 votes
by
 
Best answer

Hello Thanseer,

let me recommend you the section Identify the active Dialogs and avoid race conditions. According to the description found in this documentation, add following if-condition to the code executed by button in Screen1:

// If the current component is not the top-most dialog, ignore the event.
if ( !IsCurrentDialog())
  return;

I hope it helps you further.

Best regards

Paul Banach

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

...