Hi folks
There exists standard functionality to move a form to a separate pop-up type window (provided certain conditions).


For implementation X of mine I thought it good to open some form as a pop up by default. I thought it to be a simple task, but no.
I am reasonably sure that what I am trying to do has purposely been made impossible by MS for some reason. I am looking for some confirmation or correction. If there is a developer that has time to check me up, here are all the details you need:
The method that creates the button can be viewed in SysSystemDefinedButtons, lines 1194 through 1210.
private void AddPopoutButton(FormButtonGroupControl parentButtonGroup)
{
FormCommandButtonControl popoutButton;
if (!this.isControlFound(SystemDefinedPopoutButton))
{
popoutButton = parentButtonGroup.addControl(FormControlType::CommandButton, SystemDefinedPopoutButton);
popoutButton.command(PopoutCommand);
popoutButton.imageLocation(SysImageLocation::Symbol);
popoutButton.normalImage("PopoutExpand");
popoutButton.buttonDisplay(ButtonDisplay::ImageOnly);
}
}
The command assigned to the button comes down to macro #taskPopout defined in macro file #Task. The name of the button will be "SystemDefinedPopoutButton", defined in line 19 of macro SysSystemDefinedButtons.
If we use BankAccountTable and BankAccountTrans as example (just for demonstration), the following class should do the trick:
[ExtensionOf(formStr(BankAccountTrans))]
final class BankAccountTransFormXYZ_Extension
{
void run()
{
#Task
next run();
if (this.args().callerName() == formStr(BankAccountTable))
{
this.task(#taskPopout);
}
}
}
But it does not. The next step in my mind was to mimic the user clicking the button. In which case run() will look like this:
void run()
{
#SysSystemDefinedButtons
next run();
if (this.args().callerName() == formStr(BankAccountTable))
{
FormCommandButtonControl popoutButton = this.control(this.controlId(#SystemDefinedPopoutButton));
popoutButton.clicked();
}
}
No success. Further step would be to create your own button that does the same thing as SystemDefinedPopoutButton.
[ExtensionOf(formStr(BankAccountTrans))]
final class BankAccountTransFormXYZ_Extension
{
internal FormCommandButtonControl popoutButton;
#Task
void init()
{
next init();
this.createPopoutButton();
}
private void createPopoutButton()
{
FormButtonGroupControl buttonGroup = this.control(this.controlId(formControlStr(BankAccountTrans,ButtonGroup)));
popoutButton = buttonGroup.addControl(FormControlType::CommandButton,"DuplicatePopoutButton");
popoutButton.command(#taskPopout);
popoutButton.imageLocation(SysImageLocation::Symbol);
popoutButton.normalImage("PopoutExpand");
popoutButton.buttonDisplay(ButtonDisplay::ImageOnly);
}
}
The button works like the standard one (when you click on it). But then we want to hide the button and call it from code. The result is the same as the original method - just nothing happens. And debugging doesn't help as we are working with kernel methods.
I have tried various other variations - but I am sure the details above are enough.
It looks like the functionality will only work if one physically clicks on a command button with this task assigned to it. Then my only conclusion is that MS has purposely made this difficult or possibly impossible to achieve from code.
Any suggestion, confirmation or comments are welcome.
Thanks for reading this far.