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 > cocoa show/hide nsbox or nsview in interface builder via a button

cocoa show/hide nsbox or nsview in interface builder via a button
Thread Tools
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 15, 2004, 10:26 AM
 
I have 4 buttons in interface builder a mini toolbar in one area of my app. Question is how do I show/hide my 4 nsbox essentially I wish to have one nsbox always visible with the others almost underneath them. Almost like card-layout in swing. Click on the button and the corresponding nsbox comes to the front.
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Aug 15, 2004, 12:26 PM
 
Since NSBox inherits from NSView you should be able to use setHidden:

[boxA setHidden:TRUE];

As far as the card layout bit I'm not sure...
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 15, 2004, 10:24 PM
 
So it must be done programatically, - this is what I thought, but I was just hoping that it would have been possible in interface builder.

I will look it up.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 16, 2004, 02:57 AM
 
The basic question still remains.

I have 4 NSView were to I place them in IB one on top of each other?? Now if I am using

[boxA setHidden:TRUE];
[boxB setHidden: FALSE];
[boxC setHidden:FALSE];
[boxD setHidden: FALSE];


the above will make boxA top and visible and then to show the third boxC as visible and top do I

[boxA setHidden: FALSE];
[boxB setHidden: FALSE];
[boxC setHidden: TRUE];
[boxD setHidden: FALSE];

To bring it to the front? Or is their a better way?
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Aug 16, 2004, 04:17 PM
 
Sounds like you'd be better off with an NSTabView for your changeable UI area -- you can set it to unbordered and no tab-buttons in IB, and then have other controls whose actions call one of the -setSelectedTabViewItem... methods.
Rick Roe
icons.cx | weblog
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 16, 2004, 05:52 PM
 
Many thanks Nick, sounds much easer - K
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Aug 17, 2004, 05:13 AM
 
Remember: In Cocoa, you should not have overlapping sibling views. No guarantees are made as to the order in which they are drawn.
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Aug 17, 2004, 08:04 AM
 
Originally posted by Rickster:
Sounds like you'd be better off with an NSTabView for your changeable UI area -- you can set it to unbordered and no tab-buttons in IB, and then have other controls whose actions call one of the -setSelectedTabViewItem... methods.
That is an awesome idea Rickster! Never thought of a tab view...I can actually make use of that idea in one of my apps. Thanks.
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
   
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 01:09 PM.
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