Page 1 of 1
Notifications for new forms
Posted: Fri Aug 07, 2009 1:04 pm
by ConvertFromOldNGs
by Alan >> Tue, 28 Nov 2006 10:01:46 GMT
Not sure if I've missed something but ...
Am trying to monitor when new forms are created within an application, and to do this passively (without additional code in the forms being created). I figured the beginClassesNotification would be the way to go. Have tied this against "Form" and "GUIClass" but notifications do not appear to be generated. Any ideas?
Re: Notifications for new forms
Posted: Fri Aug 07, 2009 1:05 pm
by ConvertFromOldNGs
by BeeJay >> Tue, 28 Nov 2006 20:34:30 GMT
I'll assume you are registering for a system notification, such as Object_Create_Event. If this assumption is correct, then the following note from the online help for beginClassNotification will explain the apparent lack of notifications: ___________________________________________________
Note You can subscribe to system notifications only for persistent objects; that is, the transients parameter must be false. ___________________________________________________
As runtime forms are always created as transient objects, unfortunately that means you will need to find another way to achieve the desired result. A common approach is to have a method, say Application::loadForm, that you pass the form class that you want to create and any other standard parameters such as a "myDataObject" reference, whether to show the form immediately or leave that to the calling method, whether to use showModal, etc.
Cheers,
BeeJay.
Re: Notifications for new forms
Posted: Fri Aug 07, 2009 1:05 pm
by ConvertFromOldNGs
by allistar >> Wed, 29 Nov 2006 0:40:44 GMT
Interesting - I needed to solve the exact same problem about 4 weeks ago. Object create events are not fired for transient Window instances.
The way around it in my case is, on the load method of the single form framework superclass, do a "causeEvent".
Allistar.
Re: Notifications for new forms
Posted: Fri Aug 07, 2009 1:05 pm
by ConvertFromOldNGs
by BeeJay >> Wed, 29 Nov 2006 2:45:36 GMT
..... and make sure you have a big stick handy for dealing with any developer who implements Form::load on a subForm and doesn't add the required inheritMethod(); statement somewhere appropriate for their requirements in their reimplemented Form::load method.
Of course this all assumes that their system was designed with a single form that all other forms are subclasses of...
Cheers,
BeeJay.
Re: Notifications for new forms
Posted: Fri Aug 07, 2009 1:05 pm
by ConvertFromOldNGs
by Alan >> Wed, 29 Nov 2006 8:02:35 GMT
Thanks guys - suspected this was going to be the case ...