Hi,

here is a patch to fix a problem with PopUpMenus loaded from a gmodel file.
The PopUpMenus were always disabled and their action always set to "submenuAction:".
The patch simply sets the action after setSubmenu.
Menus and Submenus are still working with the patch.

Alternatively, a check for submenu before setting the submenu would work too.

Georg


2002-04-21  Georg Fleischmann

        * gui/Model/GMAppKit.m
        [NSMenuItem initWithModelUnarchiver:]:
        setAction after setSubmenu.


*** gui/Model/GMAppKit.m.old    Sun Apr 21 23:09:38 2002
--- gui/Model/GMAppKit.m        Sun Apr 21 23:05:02 2002
***************
*** 802,808 ****
                             decodeObjectWithName:@"mixedStateImage"]];
    [self setKeyEquivalent:[unarchiver decodeStringWithName:@"keyEquivalent"]];
    [self setState:[unarchiver decodeIntWithName:@"state"]];
-   [self setAction:[unarchiver decodeSelectorWithName:@"action"]];
    [self setTag:[unarchiver decodeIntWithName:@"tag"]];
    [self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]];
    [self setChangesState:[unarchiver decodeBOOLWithName:@"changesState"]];
--- 802,807 ----
***************
*** 826,833 ****

    /* Safety assignment. */
    [self setMenu: nil];
!   /* Set submenu.  If submenu is nil, this will set target to nil too. */
    [self setSubmenu: [unarchiver decodeObjectWithName: @"submenu"]];
    /* Set target.  This does not touch submenu. */
    [self setTarget: [unarchiver decodeObjectWithName: @"target"]];

--- 825,836 ----

    /* Safety assignment. */
    [self setMenu: nil];
!   /* Set submenu.  If submenu is nil, this will set target to nil too,
!    *               and action to submenuAction.
!    */
    [self setSubmenu: [unarchiver decodeObjectWithName: @"submenu"]];
+   /* Set action.  This does not touch submenu. */
+   [self setAction:[unarchiver decodeSelectorWithName:@"action"]];
    /* Set target.  This does not touch submenu. */
    [self setTarget: [unarchiver decodeObjectWithName: @"target"]];


_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to