Professional Web Applications Themes

Menu size - Mac Programming

Hi, I'm building a menu programmatically (not from a nib file). When I set this menu as the menu bar using [[NSApplication sharedApplication] setMainMenu]. However, doing this the menubar looks very strange with items being 50 pixels high and titles not fitting. Calling [menu sizeToFit] has no effect. Anyone got a clue ? Eric...

  1. #1

    Default Menu size

    Hi,

    I'm building a menu programmatically (not from a nib file). When I set this
    menu as the menu bar using [[NSApplication sharedApplication] setMainMenu].

    However, doing this the menubar looks very strange with items being 50
    pixels high and titles not fitting.

    Calling [menu sizeToFit] has no effect.

    Anyone got a clue ?

    Eric

    Eric Guest

  2. #2

    Default Re: Menu size

    dans l'article BCDBF14D.2204F%fr, Eric VERGNAUD
    fr a crit le 27/05/04 19:26:
     

    By the way, the same code works fine for popup menus.

    Eric

    Eric Guest

  3. #3

    Default Re: Menu size

    Eric VERGNAUD wrote: 

    i do almost this exact same thing. i use no nibs at all for any reason,
    because they're not cross-platform. i call [NSMenu sizeToFit] *before*
    setting it as the main menu, though, and from your description, it
    sounds like you might be doing it after.

    the only bit of trickiness i encountered had to do with the order of
    events. in my framework, every window can have its own menu, sort of
    like the way things work on non-mac platforms. originally i was putting
    the window onscreen and *then* setting its menu, but that turns out to
    be sub-optimal in some cirstances. when running my app under gdb,
    some process was apparently thinking "hey, this guy is displaying a
    window, but his app doesn't have a menu bar yet. i'll just help him out
    here and put up a default menubar." and then i wouldn't be able to
    display my custom menu properly. it only happened under the debugger,
    but i assumed that meant i was doing things in the wrong order, so i
    reversed the two operations, and display the menu before the window.
    now it works fine when debugging or running normally.

    so i guess you'd have to write a small example program that demonstrates
    the problem for me to see what you're doing different. but the odds are
    excellent that you'd get 30 percent finished with said example program,
    realize what it is you're doing wrong, and be able to get back to work.
    Jhnny Guest

  4. #4

    Default Re: Menu size

    dans l'article nashville.comcast.net, Jhnny
    Fvrt (it means "halo, then resonate") com a crit le
    28/05/04 4:53:
     
    >
    > i do almost this exact same thing. i use no nibs at all for any reason,
    > because they're not cross-platform. i call [NSMenu sizeToFit] *before*
    > setting it as the main menu, though, and from your description, it
    > sounds like you might be doing it after.
    >
    > the only bit of trickiness i encountered had to do with the order of
    > events. in my framework, every window can have its own menu, sort of
    > like the way things work on non-mac platforms. originally i was putting
    > the window onscreen and *then* setting its menu, but that turns out to
    > be sub-optimal in some cirstances. when running my app under gdb,
    > some process was apparently thinking "hey, this guy is displaying a
    > window, but his app doesn't have a menu bar yet. i'll just help him out
    > here and put up a default menubar." and then i wouldn't be able to
    > display my custom menu properly. it only happened under the debugger,
    > but i assumed that meant i was doing things in the wrong order, so i
    > reversed the two operations, and display the menu before the window.
    > now it works fine when debugging or running normally.
    >
    > so i guess you'd have to write a small example program that demonstrates
    > the problem for me to see what you're doing different. but the odds are
    > excellent that you'd get 30 percent finished with said example program,
    > realize what it is you're doing wrong, and be able to get back to work.[/ref]

    Well in fact I spent the whole night tracing down the problem, and it
    appears the order is indeed involved, because when I create a simple
    hard-coded menu bar it works well, but when I set it from my cross-platform
    XML file it doesn't.

    Still digging.

    Eric

    Eric Guest

  5. #5

    Default Re: Menu size - solved

    > Well in fact I spent the whole night tracing down the problem, and it 

    Believe it or not, the problem simply was in my XML file, which looked like
    the following:

    <caption>
    Hello
    </caption>

    The carriage return were taken into account...

    Aaaaarrrrggggghhhhh!

    Eric

    Eric Guest

Similar Threads

  1. Question changing font size in a form field that auto-selects text size
    By Unregistered in forum Brainstorming Area
    Replies: 0
    Last Post: June 19th, 04:18 PM
  2. Pop-up menu Size?
    By JND1993 webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 2
    Last Post: August 9th, 01:58 PM
  3. pop up menu problem, it changed the size of window
    By Hope Hope webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 0
    Last Post: July 28th, 08:52 AM
  4. Adjusting font size in a dropdown menu
    By Hunter Elliott in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 23rd, 09:14 PM

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