473 views
in GUI Development by
I am trying to implement 'exit' key through event handling using Device Class, and behind exit button i try to call a function with these lines.

var Core::Group dialog = (Core::Group)FindCurrentDialog();

DismissDialog( dialog, null, null, null, null, null, false );

but it doesnot dismiss the dialog and returns from the following lines inside DismissDialog function:

if ( dialogStack == null )
  return;

why is my dialogStack empty? where can i be possibly wrong?

PS: i am trying to implement hardware button 'exit' using application variant class.

1 Answer

0 votes
by
 
Best answer

Hello,

there can be two reasons for the problem:

1. There is in fact no dialog presented and FindCurrentDialog() returns null.

2. The found dialog has been presented in context of another component. Then you have to dismiss it also in context of this component. To query the component just evaluate the variable Owner of the found dialog.

Try following:

var Core::Group dialog = FindCurrentDialog();

if ( dialog != null )
  dialog.Owner.DismissDialog( dialog, null, null, null, null, null, false );

Does it help?

Best regards

Paul Banach

by
thank you so much, yes it helped.

Embedded Wizard Website | Privacy Policy | Imprint

...