Notifications for new forms

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Notifications for new forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:04 pm

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?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Notifications for new forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:05 pm

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.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Notifications for new forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:05 pm

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.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Notifications for new forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:05 pm

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.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Notifications for new forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:05 pm

by Alan >> Wed, 29 Nov 2006 8:02:35 GMT

Thanks guys - suspected this was going to be the case ...


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 31 guests