Re: Notifications
Re: Notifications
- Subject: Re: Notifications
- From: Chuck Hill <email@hidden>
- Date: Fri, 29 Aug 2008 14:41:12 -0700
On Aug 29, 2008, at 1:33 PM, Ted Archibald wrote: I've been racking my brains for a while now and I can't figure out how notifications work.
What I want to do is trigger a method in a session(or application) after an ERXGenericRecord has been updated/inserted. I'm pretty certain that I want to use notifications to do this, but I am lost when it comes to setting one up with the NotificationCenter.
Any ideas?
To send a notification:
NSNotificationCenter.defaultCenter().postNotification("MyObjectChangedNotification", eo);
To receive it:
NSSelector method = new NSSelector("handleChangedObject", new NSArray(new Class[] {NSNotification.class}); NSNotificationCenter.defaultCenter().addObserver(this, method, "MyObjectChangedNotification", null);
public void handleChangedObject(NSNotification notification) { EOEnterpriseObject eo = (EOEnterpriseObject) notification.object() // whatever you want to do here
}
Chuck
-- Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Notifications (From: "Ted Archibald" <email@hidden>) |