discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about NSMenuView


From: Fred Kiefer
Subject: Re: Question about NSMenuView
Date: Wed, 14 Jan 2009 22:08:35 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Germán André Arias Santiago wrote:
> El lun, 12-01-2009 a las 08:09 +0100, Wolfgang Lux escribió:
> 
>> You've got ownership wrong. A menu owns (and retains) its menu view
>> and not vice versa. Therefore, you must retain the menu somewhere
>> else in your code (probably in an attribute of the window's owner).
>> In addition, you should make the menu view the menu's representation
>> by replacing the statement [self setMenu: menu]; by
>>    [menu setMenuRepresentation: self];
>> Note that this code will not work on Mac OS X, though.
>>
>> Wolfgang
> 
> OK, now I have a retained menu, but with [menu setMenuRepresentation:
> self] I don't see the menu. If I add [menu display] ; I see the
> horizontal menu and work, but not in my MenuView. The horizontal menu
> appears outside the window, at the middle of the screen. Really, I don't
> understand this. 
> 
Getting a menu inside of a window is not that easy. You will have to
hack through NSMenu a bit. If you know what you are doing this is fine,
but don't expect to get every step explained by this mailing list. We
don't even know, whether you plan to give the resulting code back to
GNUstep.

The problem you are facing now is that setMenuRepresentation: changes
the superview of the NSMenuView, so it no longer is inside of the main
window, but now it is in the internal window of the menu. You could
simply store the super view before you call setMenuRepresentation: and
reset it after that. You surely will face a new problem after that one,
what are you plans for dealing with that? Wouldn't it be better to
address this problem more systematically?

Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]