Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Changing the initial layout

 
   Macintosh computer (Home) -> Programmer Help RSS
Next:  Bind fails with an error port is in use.  
Author Message
Colander

External


Since: Feb 06, 2008
Posts: 2



(Msg. 1) Posted: Wed Feb 06, 2008 7:23 am
Post subject: Changing the initial layout
Archived from groups: comp>sys>mac>programmer>help (more info?)

Hi All,

Trying to build my first Cocoa project, I'm having
lot's of fun, but there is this thing I can't figure out.

I'm building a game, on the right I have an openGL
thing and on the left I have Tabpages. Now I've created
4 different Tab's no problems there.

The problem is that now allways all tabs are applicable,
when the application just started, I just want to show 2
of them. So I've to do something like:

[menuBar->AdvancedTab retain];
[menuBar removeTabViewItem: menuBar->AdvancedTab];

But the thing is I've no clue where to put this code, when I put it in
any init function, I allways get an exeption that tells me that there
are no tabpages yet, same with every other place I tried. Same with
awakeFromNib.

Could you please advise how I can change the GUI just before the user
first sees it?

Thanks,
Bas

 >> Stay informed about: Changing the initial layout 
Back to top
Login to vote
Colander

External


Since: Feb 06, 2008
Posts: 2



(Msg. 2) Posted: Wed Feb 06, 2008 9:15 am
Post subject: Re: Changing the initial layout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 6, 5:10 pm, Gregory Weston wrote:
> In article
> ,
>
>
>
>  Colander wrote:
> > Hi All,
>
> > Trying to build my first Cocoa project, I'm having
> > lot's of fun, but there is this thing I can't figure out.
>
> > I'm building a game, on the right I have an openGL
> > thing and on the left I have Tabpages. Now I've created
> > 4 different Tab's no problems there.
>
> > The problem is that now allways all tabs are applicable,
> > when the application just started, I just want to show 2
> > of them. So I've to do something like:
>
> >    [menuBar->AdvancedTab retain];
> >    [menuBar removeTabViewItem: menuBar->AdvancedTab];
>
> > But the thing is I've no clue where to put this code, when I put it in
> > any init function, I allways get an exeption that tells me that there
> > are no tabpages yet, same with every other place I tried. Same with
> > awakeFromNib.
>
> > Could you please advise how I can change the GUI just before the user
> > first sees it?
>
> Normally awakeFromNib would be the place to do the kinds of things youre
> trying to do. For us to understand why it's not working for you, we'd
> need to see how/where the things you're trying to manipulate are set up.

Thanks for your help, I'll rebuild the problem in a new and clean
application,
an will describe what I do along the way....

1 Create new Cocoa application
2 Open MainMenu.nib
3 drag in a NSTabView
4 open the inspector of the NSTabView
5 make it use the class MyTabView
6 add two outlets for each 'default' tabpage of type NSTabViewItem
7 connect the two NSTabViewItem's with the blue lines to the tabpages.
8 create the MyTabView.[m|h]
9 quit IB and back to xCode, add the two files just created.
10 Make NSTabView the base class of the new class
11 add
- (void)awakeFromNib;
just before @end in the .h file
12 add
- (void)awakeFromNib
{
[self removeTabViewItem: tabOne];
}
just before @end in the .m file.

13 Hit Build and Go, Let's see....



Hmm, This works!

I've no clue what I forgot in my main application, but thanks a lot
for helping me, I'd given up on the awakeFromNib thing, you made
my try again!

Thanks,
Bas

 >> Stay informed about: Changing the initial layout 
Back to top
Login to vote
Gregory Weston1

External


Since: Oct 03, 2004
Posts: 2243



(Msg. 3) Posted: Wed Feb 06, 2008 11:10 am
Post subject: Re: Changing the initial layout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
,
Colander wrote:

> Hi All,
>
> Trying to build my first Cocoa project, I'm having
> lot's of fun, but there is this thing I can't figure out.
>
> I'm building a game, on the right I have an openGL
> thing and on the left I have Tabpages. Now I've created
> 4 different Tab's no problems there.
>
> The problem is that now allways all tabs are applicable,
> when the application just started, I just want to show 2
> of them. So I've to do something like:
>
> [menuBar->AdvancedTab retain];
> [menuBar removeTabViewItem: menuBar->AdvancedTab];
>
> But the thing is I've no clue where to put this code, when I put it in
> any init function, I allways get an exeption that tells me that there
> are no tabpages yet, same with every other place I tried. Same with
> awakeFromNib.
>
> Could you please advise how I can change the GUI just before the user
> first sees it?

Normally awakeFromNib would be the place to do the kinds of things youre
trying to do. For us to understand why it's not working for you, we'd
need to see how/where the things you're trying to manipulate are set up.
 >> Stay informed about: Changing the initial layout 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Can't get my initial nib to display -

Cocoa initial window position - how? - Hi, How do I set the intitial window position before the window is displayed for the first time? If I got it right, one should call: NSPoint p; p.x = somevalue; p.y = somevalue; [[NSApp mainWindow] setFrameOrigin: p]; It works if I call the above..

OSX keyboard layout info - I have a carbon game that needs to show an image of the keyboard for operations setup. The classic way of picking the right keyboard is this: KCAP_hndl = GetResource( 'KCAP', LMGetKbdType() ); As far as I can tell, for OSX this information is still..

help changing first responder - NSTextField is really kicking my a*... :-) If the user edits a text field and the value is invalid, I want to pop up an alert, restore the previous value, and keep the field as first responder. I can do the first two just fine in the text field..

Changing a NSToolbarItem - I need to change an NSToolbarItem's properties at will, I've never worked with them before so it is confusing. I know I can change them by ading :(id)sender at the end of the call, but that doesn't work when I need to change the options otherwise. ..
   Macintosh computer (Home) -> Programmer Help All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]