225 views
in GUI Development by
I have a screen  (we can call it "Screen A") that displays information like "Process in Progress".

When user touches on a button on Main window, this 'screen A' will be displayed (using PresentDialog) on top of Main Window until the process is finished. My assumption was this 'screen A' can prevent the user from interacting with the Main window that is now laying below the 'Sreen A'.

But user can touch on the button on Main Window again even though the top window displayed is 'Screen A'.

Please help me on how can I block user from interacting with the a window that is lying below the top window.

1 Answer

0 votes
by
 
Best answer

Hello Thanseer,

But user can touch on the button on Main Window again even though the top window displayed is 'Screen A'.

please see the section Take a closer look at the Dialog functionality, and especially the following paragraph which seems to describe your application case:

This feature permits the user to switch in the superior component between dialogs presented in it. To prevent it, use one of the following techniques:

Option 1: Place the button within a separate component and present the component as dialog (e.g. as Screen Main). Then when new dialog (e.g. Screen A) is presented, the Screen Main is automatically suppressed from being able to react to user inputs.

Option 2: Make the presented dialog (e.g. Screen A) explicitly modal (see also Modal GUI components). This will suppressed all other components from being able to react to user inputs. To achieve this, invoke BeginModal() just after invoking PresentDialog(), for example:

var Application::Alert alert = new Application::Alert;

alert.OnButton1 = onClose;

// Present the dialog
GetRoot().PresentDialog( alert, null, null, null, null, null, null, null, null, false );

// ... and make it modal
GetRoot().BeginModal( alert );

Later when the dialog is about to be dismissed, end its modal state. For example:

var Core::Group dialog = ...

// End modal state of the dialog
GetRoot().EndModal( dialog );

// ... and dismiss it
GetRoot().DismissDialog( dialog, null, null, null, null, null, false );

I hope it helps you further.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...