Discussion:
showing FORM from another, but in front of the caller
(too old to reply)
bmistiaen
2010-08-24 10:10:03 UTC
Permalink
Hello,

I have 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)?
Confuser
2010-08-29 13:49:03 UTC
Permalink
Try this,

1. Set your form to popup type in your form desgin properties.
2. By using Menufunction to call your form instead of using formRun.

Args args = new Args();

//add parm into args
args.caller(element);
new MenuFunction(menuitemdisplaystr(YourFormName),
MenuItemType::Display).run(args);

Hope this will help.
Post by bmistiaen
Hello,
I have 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)?
Loading...