Author: Paul McNett
Posted: 2009-07-07 at 11:20:18
Ed Leafe wrote:
> I've never been able to run a dForm as a modal dialog. The error is
> occurring in the code that attempts to make the form into a dialog
> temporarily, and then turn it back into a form.
There are all kinds of subtle and not-so-subtle problems with this hack.
The problems all (I think) boil down to the fact that we are changing
things at the class-definition level (IOW some basic behavior for all
instantiated forms, not just this form).
That said, I do use this in my app and it seems to work just fine. I
wanted to be able to instantiate a datanav.Form modally so I could use
it as a "pick list". So, I have a customers form defined for modifying
customer records. Now I can re-use that form to choose a customer from,
say, the orders module by doing:
frmPickCust = app.ui.FrmCustomers(self, FormMode="picklist", Modal=True)
I've probably been doing this for 2 years now with an app in the field
without trouble (although I've suspected the hack sometimes and wasted
cycles on it only to find a different root cause of a bug).
Really, if you can avoid setting dForm.Modal (by just defining your form
as a dialog instead), please do.
> I'll wait for Paul to
> comment on this, since I don't have any experience with this. I am
> pretty certain that this hack was never tested with .cdxml forms.
No I didn't test with cdxml. One of the requirements is that the Modal
property setting be sent in the constructor, not in initProperties etc.
Perhaps that's the problem?
Paul