Sharing NSViews
Hey All, Is it possible to share an NSView across two different panels or windows? I tried adding a view I already had in one of my windows to a floating panel, but that view disappeared from its original placement in the window and only showed up in the panel. thanks, c. On Aug 8, 2008, at 7:11 PM, Dustin Robert Kick wrote: I have a program set up with core data, and I have a list of predicates to filter the data shown, which work only if you type in the entire string value of the data item being used to filter, though I'm using somePath contains[cd] $value for the binding, where somePath are various paths I'm trying to filter. Is there something besides contains I should be using to get the described behavior of contains? Dustin KC9MEL ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/c%40matadata.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
Each view has knowledge of only one superview and window. If you're wanting to coordinate the two views, you'd need to wire up a controller or use notifications to keep them in sync. c. mendoza wrote: Hey All, Is it possible to share an NSView across two different panels or windows? I tried adding a view I already had in one of my windows to a floating panel, but that view disappeared from its original placement in the window and only showed up in the panel. thanks, c. On Aug 8, 2008, at 7:11 PM, Dustin Robert Kick wrote: I have a program set up with core data, and I have a list of predicates to filter the data shown, which work only if you type in the entire string value of the data item being used to filter, though I'm using somePath contains[cd] $value for the binding, where somePath are various paths I'm trying to filter. Is there something besides contains I should be using to get the described behavior of contains? Dustin KC9MEL ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/c%40matadata.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
On 9 Aug 2008, at 10:56 am, c. mendoza wrote: Hey All, Is it possible to share an NSView across two different panels or windows? I tried adding a view I already had in one of my windows to a floating panel, but that view disappeared from its original placement in the window and only showed up in the panel. Well then, you have your answer. A view presumably maintains a back reference to its superview, and only has one of these, so if it's added to a new superview it will disappear from the first one. Why do you think you need to do this anyway? If you have a view class just create a new instance of it. cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
On Aug 8, 2008, at 9:07 PM, Graham Cox wrote: Well then, you have your answer. Yes, I assumed this was so, but I wanted to check if there was something I was missing. A view presumably maintains a back reference to its superview, and only has one of these, so if it's added to a new superview it will disappear from the first one. That makes sense. Why do you think you need to do this anyway? If you have a view class just create a new instance of it. Because the two views should be synchronized On Aug 8, 2008, at 9:07 PM, Gary L. Wade wrote: Each view has knowledge of only one superview and window. If you're wanting to coordinate the two views, you'd need to wire up a controller or use notifications to keep them in sync. That should make it work. Many thanks for the quick responses. c. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
On 9 Aug 2008, at 11:44 am, c. mendoza wrote: Why do you think you need to do this anyway? If you have a view class just create a new instance of it. Because the two views should be synchronized If you need to go out of your way to synchronise two views, maybe your design could do with a bit of revision to use better MVC principles. Normally a view wouldn't have state data that required synchronisation. Instead, the (single) model contains the state data and the views just visualise it. When the model changes, the views are redrawn and thus both show the same data. If you are keeping state data in your view, move it into a model class and use a controller to mediate between the two views and the model. While it seems more complicated at first, it's well worth it because it makes the two-view scenario trivial to deal with. A good rule of thumb is that if you ever need to duplicate or synchronise the same data in two places, your design is wrong. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
On Aug 9, 2008, at 9:44 AM, c. mendoza wrote: Why do you think you need to do this anyway? If you have a view class just create a new instance of it. Because the two views should be synchronized Are they views on the same model? If they are and you have your MVC working properly, changes in one propagate to the model and then to the second view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sharing NSViews
That is a good point... my data is indeed separate from the view, all that needs synchronization is a couple of custom controls, which could perhaps be handled via notifications. thanks, c. On Aug 8, 2008, at 9:56 PM, Graham Cox wrote: On 9 Aug 2008, at 11:44 am, c. mendoza wrote: Why do you think you need to do this anyway? If you have a view class just create a new instance of it. Because the two views should be synchronized If you need to go out of your way to synchronise two views, maybe your design could do with a bit of revision to use better MVC principles. Normally a view wouldn't have state data that required synchronisation. Instead, the (single) model contains the state data and the views just visualise it. When the model changes, the views are redrawn and thus both show the same data. If you are keeping state data in your view, move it into a model class and use a controller to mediate between the two views and the model. While it seems more complicated at first, it's well worth it because it makes the two-view scenario trivial to deal with. A good rule of thumb is that if you ever need to duplicate or synchronise the same data in two places, your design is wrong. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]