Professional Web Applications Themes

Adding .nib files to Codewarrior project? - Mac Programming

I'm trying to add a menu bar that I've created in Project Builder and stored as a .nib file to my Codewarrior project. However, when I go to "add files to project" it sees my .nib file as a directory and offers me the choice of adding "classes.nib" or "info.nib" to my project. What's the best way to add my MenuBar to my project? I've tried adding both of them, but the code: // Search the bundle for a .nib file named 'classes'. err = CreateNibReference(CFSTR("info"), &nib_ref); // also tried "classes" if (err == noErr) { // We found it, ...

  1. #1

    Default Adding .nib files to Codewarrior project?

    I'm trying to add a menu bar that I've created in Project Builder and
    stored as a .nib file to my Codewarrior project.

    However, when I go to "add files to project" it sees my .nib file as a
    directory and offers me the choice of adding "classes.nib" or "info.nib"
    to my project.

    What's the best way to add my MenuBar to my project?

    I've tried adding both of them, but the code:

    // Search the bundle for a .nib file named 'classes'.
    err = CreateNibReference(CFSTR("info"), &nib_ref);
    // also tried "classes"
    if (err == noErr)
    {
    // We found it, now use it to make our menus
    OSStatus err = SetMenuBarFromNib(nib_ref, CFSTR("MenuBar"));
    if (err != noErr )
    {
    do_status_message("\pUnable to load MenuBar from nib!");
    }
    DisposeNibReference(nib_ref);
    }
    else
    {
    do_status_message("\pUnable to find MenuBar nib!");
    }

    fails at the call to SetMenuBarFromNib().

    Apparently it's not seeing my MenuBar inside either file.

    Thanks for any help with this.

    CT
    Charles Guest

  2. #2

    Default Re: Adding .nib files to Codewarrior project?

    On Wed, 14 Jan 2004, Charles Thomas wrote:
     

    You don't actually need to do this. I don't add nibs to my Carbon
    projects. Just copy the nib (not the classes.nib/info.nib, those are both
    part of the "real" nib) to your resources folder (in the appropriate
    language folder if necessary).


    Fred
     

    Frederick Guest

  3. #3

    Default Re: Adding .nib files to Codewarrior project?

    In article
    <srcf.societies.cam.ac.uk>
    ,
    Frederick Cheung <DUH.ucam.org> wrote:
     
    >
    > You don't actually need to do this. I don't add nibs to my Carbon
    > projects. Just copy the nib (not the classes.nib/info.nib, those are both
    > part of the "real" nib) to your resources folder (in the appropriate
    > language folder if necessary).[/ref]

    I'm not sure what you mean by "my resources folder". There are hundreds
    of "resources" folders on my computer. Which one do you mean?

    Also, I'm not sure I want to add a .nib file to some remote folder not
    associated with my Codewarrior project. It seems very cluttered to have
    a folder full of nib files from various projects all in a remote
    location not associated with their projects.

    Somewhere down the road that file is going to get lost. I'd rather keep
    it in the same folder as my project, or better still, add it to my
    project.

    CT
    Charles Guest

  4. #4

    Default Re: Adding .nib files to Codewarrior project?

    In article <doit.wisc.edu>,
    Charles Thomas <facstaff.wisc.edu> wrote:
     

    You don't add it to the files tab, open the package tab and drag and
    drop it to there.

    Ron
     

    --

    Metrowerks, maker of CodeWarrior - "Software Starts Here"
    Ron Liechty - com - <http://www.metrowerks.com>
    MW Guest

  5. #5

    Default Re: Adding .nib files to Codewarrior project?

    In article <doit.wisc.edu>,
    Charles Thomas <facstaff.wisc.edu> wrote:
     
    > >
    > > You don't actually need to do this. I don't add nibs to my Carbon
    > > projects. Just copy the nib (not the classes.nib/info.nib, those are both
    > > part of the "real" nib) to your resources folder (in the appropriate
    > > language folder if necessary).[/ref]
    >
    > I'm not sure what you mean by "my resources folder". There are hundreds
    > of "resources" folders on my computer. Which one do you mean?[/ref]

    Never mind. The application package contents:resources folder.

    This works fine. Many thanks!

    CT
    Charles Guest

  6. #6

    Default Re: Adding .nib files to Codewarrior project?

    Charles Thomas wrote: 

    there will be a resources folder somewhere inside your project folder.
    that resources folder gets copied inside your application bundle at the
    time the app is built/linked. it has to, because the app's .nibs are
    needed at runtime. if they're not there, the app won't work.

    given what you wrote above, i'm guessing you don't know that what looks
    like an application when viewed in the finder is really a folder with
    some special properties. it's called a bundle. it contains the app's
    binary executable and all its resources, like strings files, icons, and
    nibs. bundles are used for other things besides just packaging
    applications.
     

    no it won't, because your app won't run without it.

    an app's .nibs are accessible by end users, which has given rise to a
    whole new class of app-hacking. recently i ran across a hack for
    netnewswire that rearranges the panes in its main window.
    Jhnny Guest

  7. #7

    Default Re: Adding .nib files to Codewarrior project?

    On Wed, 14 Jan 2004, Charles Thomas wrote:
     
    > >
    > > You don't actually need to do this. I don't add nibs to my Carbon
    > > projects. Just copy the nib (not the classes.nib/info.nib, those are both
    > > part of the "real" nib) to your resources folder (in the appropriate
    > > language folder if necessary).[/ref]
    >
    > I'm not sure what you mean by "my resources folder". There are hundreds
    > of "resources" folders on my computer. Which one do you mean?[/ref]

    If your application is bundled, then it has a Resources folder as part of
    its bundle. If not, then you can put the nib wherever you want.
    In any case, nibs are not built into the application in the same way that
    a resource file is.

    Fred
     

    Frederick Guest

  8. #8

    Default Re: Adding .nib files to Codewarrior project?

    In article <newsguy.com>,
    MW Ron <com> wrote:
     

    I opened the package itself and put it in the "contents:resources"
    folder in there there and that seemed to work.

    Just out of curiosity, I see "Files" "Link Order" "Frameworks" and
    "Target" tabs, but don't see a "Package" tab.

    Am I using an outdated version of CW? It says IDE version 5.1.1 build
    1108.

    CT
    Charles Guest

  9. #9

    Default Re: Adding .nib files to Codewarrior project?

    In article <doit.wisc.edu>,
    Charles Thomas <facstaff.wisc.edu> wrote:
     
    >
    >I opened the package itself and put it in the "contents:resources"
    >folder in there there and that seemed to work.
    >
    >Just out of curiosity, I see "Files" "Link Order" "Frameworks" and
    >"Target" tabs, but don't see a "Package" tab.
    >
    >Am I using an outdated version of CW? It says IDE version 5.1.1 build
    >1108.[/ref]

    Right, Packages was added with CW 9 to handle this stuff much better.

    Ron

    --

    Metrowerks, maker of CodeWarrior - "Software Starts Here"
    Ron Liechty - com - <http://www.metrowerks.com>
    MW Guest

Similar Threads

  1. xdk with CodeWarrior
    By Dr.Phreak webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 0
    Last Post: December 4th, 08:39 AM
  2. Extension : adding a new file to the project
    By Mickael Faivre-Macon in forum PHP Development
    Replies: 1
    Last Post: August 28th, 03:43 AM
  3. CodeWarrior 8.3 Question
    By Eric Edwards in forum Mac Programming
    Replies: 1
    Last Post: August 13th, 02:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139