Sometimes you need to communicate with the
RunBase object's dialog. Here are some information what you have to know to make it run well.
The Caller
Say, your
RunBase dialog calls a custom form which contains special selection settings for the
RunBase object (which f.ex. cannot be integrated in the
RunBase dialog due layout specifications). So you've placed a m
enu item button to your dialog. That way the user can call the custom form with the special selection settings:
DialogRunbase ret;
;
ret = super(dialog, forceOnClient);
ret.addMenuItemButton(MenuItemType::Display,
menuItemDisplayStr(MyRunBaseSelectionForm));
But once the custom form is open, how to geht a handle to the
RunBase object? To grab the
RunBase object you need to dig the callers:
FormRun formRunCaller;
DialogRunBase dialogRunBase;
MyRunBaseClass caller;
;
formRunCaller = element.args().caller(); // returns the dialog's form
// returns a DialogRunBase object
dialogRunBase = formRunCaller.args().caller();
// finally returns the RunBase object
caller = dialogRunBase.runBaseBatch();
Once you have the handle to the
RunBase object you can acceed all public parameter methods and even the
RunBase's QueryRun object.
Notify the caller
If the user decide to close your custom form with confirmation, so you need to notify the
RunBase object about the new data. The best way is to place this code in the method c
loseOK() on your custom form:
public void closeOk()
{
QueryRun qr = caller.queryRun();
;
qr.whatEverYouHaveToManipulate(...);
caller.parmThisAndThat(...);
super();
}
Update the dialog values
As the user shall see the setting changes, you need to update the dialog controls. That for you can use the method
dialogUpdate():
public void closeOk()
{
QueryRun qr = caller.queryRun();
;
qr.whatEverYouHaveToManipulate(...);
caller.parmThisAndThat(...);
caller.dialogUpdate(); // updates at least query range fields
super();
}
If you want a little tutorial, you can download this
sample project, demonstrates just what I tried to explain. Import the
XPO file and open the class MyRunBaseClass, then click on the button "Pick customer".
Keep in mind, it's only a tutorial, the code is neither BP nor fool proofed!
Hope this can improve your coding skills :)