Reputation: 1569
I call a class form MyForm
. In my class I have if-else
statements. I want to close all processes. I need a command that looks like
element.close();
Example, my code:
if (_condition a_)
{
//operations class;
}
if(_condition b_)
{
//abort all, and close all;
}
How should I do if I am not in form? I would close all cycle by code from my class.
Upvotes: 2
Views: 1123
Reputation: 382
You can start your form with the FormRun class and close it again with formRun.close(). Remember to call formRun.wait() when you want the form to remain open and wait for an action from the user.
static void openCloseForm(Args _args)
{
FormRun formRun;
Args args = new Args();
args.name(formstr(MyForm));
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
if (_condition a_)
{
//operations class before user input;
formRun.wait();
//operations class after user input;
}
if(_condition b_)
{
formRun.close();
}
}
Upvotes: 2