Reputation: 4437
I am making a dialog with a command. This command must close the dialog and go back to the previous form, but it is not working as expected. When I press the command, it closes the dialog but the form do not go back.
I am using the resource editor. State machine controls the app´s navigation.
The code inside the command´s logic is:
dialog.dispose();
StateMachine.back();
Is dispose()
the method that I must use to close my dialog?
Thanks for reading.
Upvotes: 1
Views: 834
Reputation:
There is another solution : try to use the protected void onShowCompleted()
method that you must implement in your Form
. And declare a boolean
variable in your Form
( for example private boolean isDialogShown;
), then in the constructor
of your Form
set that boolean variable to false
, and just before the code of opening the Dialog
set its value to true
. Then in the code of the protected void onShowCompleted()
test if it is true , and if it is true then set it to false and perform the back action : backForm.showBack();
Upvotes: 2
Reputation: 52760
As Nirmal said disposing the dialog goes to the previous form so while your call to "back()" works as expected your call to dispose() breaks that logic.
You can override the postShow method for the form you are showing and detect the case of leaving the dialog (just turn on a flag when you need to go back) and call the back method when the form is shown in that condition.
Upvotes: 2
Reputation: 12054
dont call StateMachine.back()
just use dialog.dispose();
Upvotes: 2