Programming question

Hello, I have a question:

I have a method that shows a formindialog and then goes on to do many things. The formindialog has a button “OK” and a button “Cancel”. If the user hits Cancel, I do not want things to go on. What is the best way to implement this?

Something needs to happen after application.showFormInDialog.

Thanks
Patrick

Don’t know if this is the best way to do this but I would define a form or global variable that is checked every time the method ‘does it’s thing’.

When you show the form you set the variable to 1 and by hitting the cancel button you set the variable to 0.

When you want to completely cancel all ‘things that have been done’ you can use a transaction that you rollback on hitting the cancel button.

Does this help? Or am I thinking the wrong way?

Thanks for your answer. A transaction doesn’t do it because the real “data action” starts after the dialog. The global is the only way I see to do it but it sounds a little like “doing it the FM way”, if you know what I mean.

patrick:
… global is the only way I see to do it but it sounds a little like “doing it the FM way”, if you know what I mean.

May be more elegant and less “FM way” can be to define the global variable “on the fly” and not “hard-wired” in the data structure:

quick_var = 0;
application.showFormInDialog(....);
if (quick_var == 1) .....

and in the method associated to the cancel button (and to the onHide property):

quick_var = 1;

ciao