Re: Switching Contents of NSView
On Jul 5, 2009, at 6:31 PM, I. Savant wrote: Read the documentation. It replaces the view you specify with the other view you specify. Put each group in their own container views, then only swap the containers ... ... to be specific, you'll tell the *parent* view (in which you're swapping subviews) to -swapView:withView: between the two containers. -- I.S. ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubview:with: -- I.S. ___ 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 arch...@mail-archive.com
Switching Contents of NSView
Hi Everyone: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Thanks for any help! ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. On 7/5/09 3:31 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:30 PM, Pierce Freeman wrote: And for the NSView function that you suggested, does this replace all the subviews in that view as I will most likely have more then one? Read the documentation. It replaces the view you specify with the other view you specify. Put each group in their own container views, then only swap the containers ... -- I.S. ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
You're right, I was looking in the wrong place. A good Google search (versus the built in documentation) did the trick. For future reference, it's under NSBundle Additions versus the plain NSBundle. On 7/5/09 3:45 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
If you are suggesting Google was the right place to look, unfortunately you are mistaken. Directly underneath the toolbar of the documentation window should be a scope bar that attempts to help you find the information you're looking for. Perhaps you're searching the documentation by Title instead of by API? If I search by API and type loadNibNamed I immediately get the NSBundle Additions API, however if I search by Title I get nothing. Hope this helps, Kiel On 06/07/2009, at 8:55 AM, Pierce Freeman wrote: You're right, I was looking in the wrong place. A good Google search (versus the built in documentation) did the trick. For future reference, it's under NSBundle Additions versus the plain NSBundle. On 7/5/09 3:45 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
I am finally reverting to using NSView's replaceSubview:with: command. The only problem is that when I run this command partnered with addSubview, it removes the view from the window where I placed it originally. This is problematic when I try to go back and forth between views as the application can no longer find the view and then crashes. Any suggestions? On 7/5/09 3:21 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubvi ew:with: -- I.S. ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
Kiel: Wasn't suggesting Google is always the right place to look, but in this case it just happened to find it right away. And just checked my preferences, and it did in fact have title selected. Will have to change that... On 7/5/09 4:25 PM, Kiel Gillard kiel.gill...@gmail.com wrote: If you are suggesting Google was the right place to look, unfortunately you are mistaken. Directly underneath the toolbar of the documentation window should be a scope bar that attempts to help you find the information you're looking for. Perhaps you're searching the documentation by Title instead of by API? If I search by API and type loadNibNamed I immediately get the NSBundle Additions API, however if I search by Title I get nothing. Hope this helps, Kiel On 06/07/2009, at 8:55 AM, Pierce Freeman wrote: You're right, I was looking in the wrong place. A good Google search (versus the built in documentation) did the trick. For future reference, it's under NSBundle Additions versus the plain NSBundle. On 7/5/09 3:45 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
Make sure you heed this part of the documentation: This method causes oldView to be released; if you plan to reuse it, be sure to retain it before sending this message and to release it as appropriate when adding it as a subview of another NSView. --Andy On Jul 5, 2009, at 7:26 PM, Pierce Freeman wrote: I am finally reverting to using NSView's replaceSubview:with: command. The only problem is that when I run this command partnered with addSubview, it removes the view from the window where I placed it originally. This is problematic when I try to go back and forth between views as the application can no longer find the view and then crashes. Any suggestions? On 7/5/09 3:21 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/ replaceSubvi ew:with: -- I.S. ___ 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/aglee%40mac.com This email sent to ag...@mac.com ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
Once again, I fail when the documentation succeeds. I¹ll have to work on my documentation reading skills over the next week or so. On 7/5/09 4:33 PM, Andy Lee ag...@mac.com wrote: Make sure you heed this part of the documentation: This method causes oldView to be released; if you plan to reuse it, be sure to retain it before sending this message and to release it as appropriate when adding it as a subview of another NSView. --Andy On Jul 5, 2009, at 7:26 PM, Pierce Freeman wrote: I am finally reverting to using NSView's replaceSubview:with: command. The only problem is that when I run this command partnered with addSubview, it removes the view from the window where I placed it originally. This is problematic when I try to go back and forth between views as the application can no longer find the view and then crashes. Any suggestions? On 7/5/09 3:21 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Clas se s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSub vi ew:with: -- I.S. ___ 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/aglee%40mac.com This email sent to ag...@mac.com ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
Pierce, As an adjunct to document reading skills, I've found that there's no substitute for a class browser. Andy Lee has written Appkido, an excellent class browser for Cocoa! http://homepage.mac.com/aglee/downloads/appkido.html There are other ways to browse the Cocoa class hierarchy, but Appkido is my favorite :-) Thanks Andy!! Yours in Cocoa, Joel ___ 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 arch...@mail-archive.com
Re: Switching Contents of NSView
Joel: Thanks for the link - I'll definitely check it out. On 7/5/09 6:50 PM, Joel Norvell framewor...@yahoo.com wrote: Pierce, As an adjunct to document reading skills, I've found that there's no substitute for a class browser. Andy Lee has written Appkido, an excellent class browser for Cocoa! http://homepage.mac.com/aglee/downloads/appkido.html There are other ways to browse the Cocoa class hierarchy, but Appkido is my favorite :-) Thanks Andy!! Yours in Cocoa, Joel ___ 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 arch...@mail-archive.com