Discussion:
showing FORM from another, but closing the caller.
(too old to reply)
Marcos Tito
2007-05-18 20:06:00 UTC
Permalink
Dear friends,

How can I show an second FORM from an button click, keeping it openned but
imediatelly closing the caller.

In my code when I do this, the caller form remains opened until I close the
new called form.

Thanks in advance,
Marcos Tito.
unknown
2007-05-19 08:34:06 UTC
Permalink
How do you a open a form on a button?

You should use formRun class for this case
Well, in turms of FormRun, you have to detach the form instead of waitng for
it to call.

This means, that you have to substitute one line of code:
//the clicked method of your button. (If it is a button)
void clicked()
{
Args args = new Args(formStr(CustTable));
FormRun formRun;
;
super();
formRun = classFactory.formRunClass(args);
formRun.run();
//formRun.wait();
formRun.detach();

element.close();
}
--
Kashperuk Ivan (Vanya),
Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Marcos Tito
Dear friends,
How can I show an second FORM from an button click, keeping it openned but
imediatelly closing the caller.
In my code when I do this, the caller form remains opened until I close the
new called form.
Thanks in advance,
Marcos Tito.
Marcos Tito
2007-05-19 11:19:00 UTC
Permalink
Thank you very much !!!
Post by unknown
How do you a open a form on a button?
You should use formRun class for this case
Well, in turms of FormRun, you have to detach the form instead of waitng for
it to call.
//the clicked method of your button. (If it is a button)
void clicked()
{
Args args = new Args(formStr(CustTable));
FormRun formRun;
;
super();
formRun = classFactory.formRunClass(args);
formRun.run();
//formRun.wait();
formRun.detach();
element.close();
}
--
Kashperuk Ivan (Vanya),
Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Marcos Tito
Dear friends,
How can I show an second FORM from an button click, keeping it openned but
imediatelly closing the caller.
In my code when I do this, the caller form remains opened until I close the
new called form.
Thanks in advance,
Marcos Tito.
bmistiaen
2010-08-24 09:32:03 UTC
Permalink
Hello,

This solution works, but there's a catch.
In my case, I have the same code in a mouseDblClick method on a Tree object
in a form (A).
When I doubleclick, the called form (B) is opened, but since there's still
code left to be executed in the caller (A), the caller (A) gets focus again.
The result of this is that the called form (B) is opened BEHIND the calling
form (A).

public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean
_Shift)
{
int ret;
Args parameters = new Args();
FormRun formRun;
;

ret = super(_x, _y, _button, _Ctrl, _Shift);

parameters.name(formstr(SalesTable));
formRun = ClassFactory::formRunClassOnClient(parameters);
formRun.init();
formRun.run();
//formRun.wait();
formRun.detach();

return ret;
}

When I use wait() instead of detach(), then the called form (B) stays in
front of the calling form (A).
The drawback is then, that the user CANNOT CLOSE calling form (A), before
the called form (B) is closed.

So, the question is if there's a solution to have (B) open in front of (A)
in a mouseDblClick method,
whith the user still being able to close (A) before (B)?
Post by unknown
How do you a open a form on a button?
You should use formRun class for this case
Well, in turms of FormRun, you have to detach the form instead of waitng for
it to call.
//the clicked method of your button. (If it is a button)
void clicked()
{
Args args = new Args(formStr(CustTable));
FormRun formRun;
;
super();
formRun = classFactory.formRunClass(args);
formRun.run();
//formRun.wait();
formRun.detach();
element.close();
}
--
Kashperuk Ivan (Vanya),
Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Marcos Tito
Dear friends,
How can I show an second FORM from an button click, keeping it openned but
imediatelly closing the caller.
In my code when I do this, the caller form remains opened until I close the
new called form.
Thanks in advance,
Marcos Tito.
Loading...