Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Creating Toolbars for Mac OS X
Subject:   Customize menu item disabled
Date:   2002-03-31 13:19:59
From:   zeus
Hello everyone,
I'm a bit late on this tutorial.
I try to finish the first part of it before customization and my problem is that the "Customize Toolbar" menu item is disabled (when I'm running the soft or even when I'm testing the interface in Interface Builder).
Does anyone know how to solve the problem?
Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Customize menu item disabled
    2002-04-05 18:41:52  michele [View]

    Hello Zeus (my God!:-),

    It's perfectly normal that the item is disabled in Interface Builder as the toolbar is not initialized.

    In your code, in Controller.m, you have to set up the toolbar.

    in awakeFromNib:

    [self setUpToolbar];

    and then add the following method in Controller.m:

    - (void) setupToolbar
    {
    NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier: @"mainToolbar"] autorelease];
    [toolbar setDelegate: self];
    [toolbar setAllowsUserCustomization: YES];
    [toolbar setAutosavesConfiguration: YES];
    [mainWindow setToolbar: toolbar];
    }

    In controller.h , declare it:

    - (void) setupToolbar;

    And don't omit to implement the toolbar category.

    Hope this helps you,
    Michèle
    • Customize menu item disabled
      2002-04-06 03:28:17  zeus [View]

      God is grateful to you humble mortal ;-)
      and God should learn reading before posting stupid thread.
      But now that everything should work I get a stupid:"AddressBook.app has exited due to signal 10 (SIGBUS)."or "AddressBook.app has exited due to signal 11 (SIGSEGV)." It depends on where I put my [self setupToolbar] in the awakeFromNib method.

      CU Jerome
      • Customize menu item disabled
        2002-04-07 12:33:53  michele [View]

        Hello Jerome,

        I put it at the very end of the awakeFromNib method.

        Is your code compiling, or do you get the error on building?

        Those errors normally are thrown when you attempt to get an object with null address: i.e. an object already released (either by you or the autorelease pool), an object that does not exist yet, ...

        If the code compiles, you can try to put a breakpoint at the very beginning of the awakeFromNib method, or init method, and go through the debugger step by step, check as many object as you can, printing the description by control-clicking on the object in the debugger.

        Another way is to put a new breakpoint and type directly -[NSException raise] so that the debugger breaks when an exception is raised, then you back trace.

        Also you can set a new variable in executable part of the target:

        NSZombieEnabled

        Set it to YES. Then the debugger prints a message when you attempt to call an object already released.

        We can follow this discussion out of the forum. My email address is: garoche.michele@wanadoo.fr

        Michele