I have a drop dialog form and I need to pass an object into it from the caller form. To set parmObject, I usually use an override of clicked() similar to this:
void clicked() { Args args = new Args(); args.caller(element); args.parmObject(someObject); args.record(someTable); this.menuFunction().run(args); }
It works well for normal menu item buttons, but not for drop dialogs, because MenuFunction.run() isn't aware of that I want to open the form as a drop dialog.
To solve this problem, I would need either to find a correct way of opening drop dialogs from code, or to set parmObject() without overriding clicked() of the DropDialogButton.
I will be surprised if it can be done, but if it is, it will be useful to learn.
I surely can use a workaround, such as exposing the object by a method on the caller form, but the resulting form is uglier and more tightly coupled with a particular caller form than if I just get an object and check its type.
*This post is locked for comments
Ok - tnx!
I decided to use the caller to provide the parameter object - even there is the possibility to use this.parameters() in clicked event to provide a string to the dialog's args.parm() property. I prefere to have the object instance then to serialize and deserialize it.
br
Beat
No; it seems that I was right in assuming that it can't be done directly.
I used the workaround mentioned at the end of my post. This is (roughly) what I do in init() of the dialog form:
Object caller = element.args().caller() as FormRun; if (caller && formHasMethod(caller, identifierStr(getMyObject))) { myObject = caller.getMyObject(); }
Hi Martin,
I have the same requirement - did you got a solution?
br
Beat
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156