I have found the problem which causes this strange behavior.
It is caused by the insertion of the following into the 
gmodel generated by nib2gmodel:

    "Object   15" = {
        action = "submenuAction:";
        image = "Object   16";
        isEnabled = YES;
        isa = NSMenuItem;
        keyEquivalent = "";
        representedObject = nil;
        state = 0;
        tag = 0;
        target = "Object   17";
        title = Info;
    };
    "Object   16" = {isa = NSImage; name = NSMenuArrow; size = "{width = 12;
height = 9}"; };

Each menu item has the image value set if it has a submenu.
This causes the following code in NSMenuItemCell to draw an 
extra arrow before (to the left of) the menu title:

- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
.
.
.
.
  if (mcell_imageToDisplay)
    {
      mcell_imageWidth = [mcell_imageToDisplay size].width;
    }

  // Draw the state image
  if (mcell_stateImageWidth > 0)
    [self drawStateImageWithFrame: cellFrame inView: controlView];

  // Draw the image
  if (mcell_imageWidth > 0)
    [self drawImageWithFrame: cellFrame inView: controlView];

  // Draw the title
  if (mcell_titleWidth > 0)
    [self drawTitleWithFrame: cellFrame inView: controlView];

  // Draw the key equivalent
  if (mcell_keyEquivalentWidth > 0)
    [self drawKeyEquivalentWithFrame: cellFrame inView: controlView];

  _backgroundColor = nil;
}

The arrow after (on the right) is drawn by the code in the call:

  // Draw the key equivalent
  if (mcell_keyEquivalentWidth > 0)
    [self drawKeyEquivalentWithFrame: cellFrame inView: controlView];

from above.   The image setting in the gmodel is, therefore, not needed.

To test my hypothesis I created a test app and nib and ran nib2gmodel on it.
I ran the app and saw the menu problem.  I then went into the gmodel
file and eliminated all of the "image" lines from the NSMenuItem entries
and ran the application again.  The menus were rendered correctly after
that change.

I will make the necessary code fixes in nib2gmodel and submit a
patch.

Thanks, GJC



=====
======================================================
Gregory John Casamento           Sr. Software Engineer
Java, C++, Objective C           [EMAIL PROTECTED]
======================================================
Those who do not value their freedom shall loose it..
======================================================

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Reply via email to