Set the target/action to nil/NULL so that the items are enabled

This commit is contained in:
Gregory John Casamento 2024-12-08 23:11:18 -05:00
parent 71114f34c6
commit 92ac127ebc
2 changed files with 20 additions and 2 deletions

View file

@ -64,11 +64,24 @@
- (void) finishInstantiate - (void) finishInstantiate
{ {
NSView *contentView = [originalWindow contentView]; NSView *contentView = [originalWindow contentView];
NSArray *allItems = nil;
NSEnumerator *en = nil;
id item = nil;
_prototypePopUp = [[GormNSPopUpButton alloc] initWithFrame: NSMakeRect(71.0, 157.0, 102.0, 24.0)]; _prototypePopUp = [[GormNSPopUpButton alloc] initWithFrame: NSMakeRect(71.0, 157.0, 102.0, 24.0)];
[_prototypePopUp addItemWithTitle: @"Item #0"]; [_prototypePopUp addItemWithTitle: @"Item #0"];
[_prototypePopUp addItemWithTitle: @"Item #1"]; [_prototypePopUp addItemWithTitle: @"Item #1"];
[_prototypePopUp addItemWithTitle: @"Item #2"]; [_prototypePopUp addItemWithTitle: @"Item #2"];
[_prototypePopUp setAutoenablesItems: YES];
allItems = [[_prototypePopUp menu] itemArray];
en = [allItems objectEnumerator];
while ((item = [en nextObject]) != nil)
{
[item setTarget: nil];
[item setAction: NULL]; // @selector(_popUpItemAction:)];
[item setEnabled: YES];
}
[contentView addSubview: _prototypePopUp]; [contentView addSubview: _prototypePopUp];
AUTORELEASE(_prototypePopUp); AUTORELEASE(_prototypePopUp);

View file

@ -78,8 +78,13 @@
[object setPullsDown: pullsDown]; [object setPullsDown: pullsDown];
while ((o = [en nextObject]) != nil) while ((o = [en nextObject]) != nil)
{ {
id<NSMenuItem> mi = nil;
[object addItemWithTitle: [o title]]; [object addItemWithTitle: [o title]];
} mi = [object lastItem];
[mi setAction: NULL]; // @selector(_popUpItemAction:)];
[mi setTarget: nil];
}
} }
else if (sender == autoenableSwitch) else if (sender == autoenableSwitch)
{ {