Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Got them low-down dirty NSView blues...

Got them low-down dirty NSView blues...
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Apr 21, 2002, 09:15 PM
 
How do I switch out views in a window. I basically have several different views that I want to display depending on buttons pressed in the toolbar. The views should just replace one another in the window. How do I switch them?

kman
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Apr 21, 2002, 09:31 PM
 
Originally posted by kman42:
<STRONG>How do I switch out views in a window. I basically have several different views that I want to display depending on buttons pressed in the toolbar. The views should just replace one another in the window. How do I switch them?

kman</STRONG>
I believe you're looking for setContentView? Just pass it any view and it should update the window.
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Apr 21, 2002, 09:48 PM
 
If I don't want everything in the window to change, but just some items can I just group them in a custom view and then send the custom view the setContentView or does it only work on windows?

I just checked for a setContentView in NSView and couldn't find it so I guess the answer is no.

Do I just have to release the views I want to disappear and instantiate new views programmatically when I want them to appear?
kman

edit-answered my own question

[ 04-21-2002: Message edited by: kman42 ]
     
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Apr 21, 2002, 10:01 PM
 
From your description, it sounds like the easiest thing is to just use an NSTabView, and set it to not display the tabs (setTabViewType: NSNoTabsNoBorder). You can then programmatically switch between the views by calling any of the various selectTabViewItem methods.
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Apr 21, 2002, 10:28 PM
 
Originally posted by Porfiry:
<STRONG>From your description, it sounds like the easiest thing is to just use an NSTabView, and set it to not display the tabs (setTabViewType: NSNoTabsNoBorder). You can then programmatically switch between the views by calling any of the various selectTabViewItem methods.</STRONG>

I like that idea. I'm also curious how people get their windows to 'slide' from view to view. For instance, when you click on a preference button in the System Prefs.

kman
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Apr 21, 2002, 11:43 PM
 
Originally posted by kman42:
<STRONG>


I like that idea. I'm also curious how people get their windows to 'slide' from view to view. For instance, when you click on a preference button in the System Prefs.

kman</STRONG>
have a look at nswindow's setFrame:display:animate: -- use "YES" for "animate"...
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Apr 22, 2002, 01:31 AM
 
And if you still need help, look at the freely available OmniAppKit source code -- we do the animating resizing thing in OAPreferenceController.
Rick Roe
icons.cx | weblog
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:51 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2