Hi,
I am trying to implement a series of popups which have different priority to be displayed. My intention is to show a popup (NewPopup) in the next situations:
a) No popup is currently displayed, so NewPopup is shown immediately;
b) A popup is currently displayed (CurrentPopup) and NewPopup priority is greater than CurrentPopup priority, so NewPopup is shown immediately;
c) A popup is currently displayed and NewPopup priority is equal to or lower than CurrentPopup priority, so NewPopup should be shown once CurrentPopup is dismissed.
For this purpose, one method and two variables are used as explained below:
- A "bool" variable called PopupOn is set to "true" when a popup is being shown (CurrentPopup). When CurrentPopup is dismissed, slot method "managePopup" set this variable to "false".
- A "int32" variable called PopupPrio stores current popup priority value as follows: <CurrentPopup.StackingPriority+1>. When CurrentPopup is dismissed, slot method "managePopup" set this variable to 0 (no priority).
- The created method with the name NewPopup() have six arguments and returns a popup with the desired appearance, according to given values for arguments. One of the arguments is a "int32" variable (aPriority) used to set StackPriority of the popup (0-low, 1-medium or 2-high priority). The method also presents the popup by means of "PresentDialog()", taking into account Stacking priority and information stored in PopupOn and PopupPrio to determine the current situation (a, b or c). This method may be called by several slot methods at the same time (every slot 'listens to' a specific boolean variable and calls the method to show a popup when variable value is "true").
NOTE: Popup is automatically dismissed when popup button is pressed or popup progress bar (Effectss::RectEffect used on a rectangle view for this purpose) is complete.
So far, I have achieved that popup is displayed successfully in situations a and b. However, I am not able to make NewPopup remain waiting for CurrentPopup to be dismissed, since CurrentPopup progress bar gets interrupted when "while" loop is reached in situation c. You can find the code of NewPopup() method below:
var SCREENS::Alert popup = new SCREENS::Alert;
//Here popup is cutomized (text, color, button...) according to passed in arguments, including StackPriority
//...
//...
//...
popup.StackingPriority = aPriority;
popup.onDone = managePopup;
if (!PopupOn) //situation a
{
PresentDialog( popup, null, null, null, null, null, null, null, null, false );
PopupOn = true;
PopupPrio = aPriority+1;
}
else
{
if (PopupPrio < (aPriority+1)) //situation b
{
PresentDialog( popup, null, null, null, null, null, null, null, null, false );
PopupOn = true;
PopupPrio = aPriority+1;
}
else //situation c
{
while (!IsCurrentDialog())
{
continue; //here I have tried many different sentences, but while loop is never done
}
PresentDialog( popup, null, null, null, null, null, null, null, null, true );
PopupOn = true;
PopupPrio = aPriority+1;
}
}
return popup;
I understand that in situation c, "IsActiveDialog()" is "true" for NewPopup, although it is presented below CurrentPopup (hidden for user) due to StackPriority value, but "IsCurrentDialog()" is still "true" for CurrentPopup. I see the conflict but not how to solve this. Obviously, I am not using "while" loop properly, but I do not know how to evaluate when CurrentPopup gets dismissed and triggers NewPopup presentation.
Could you give me a helping hand here?
Thanks in advance and best regards,
Fayna