From 92ac127ebcd514b845c76121be1f269c17b78e6d Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 8 Dec 2024 23:11:18 -0500 Subject: [PATCH] Set the target/action to nil/NULL so that the items are enabled --- .../Gorm/Palettes/2Controls/ControlsPalette.m | 15 ++++++++++++++- .../GormPopUpButtonAttributesInspector.m | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Applications/Gorm/Palettes/2Controls/ControlsPalette.m b/Applications/Gorm/Palettes/2Controls/ControlsPalette.m index bb318353..8568da96 100644 --- a/Applications/Gorm/Palettes/2Controls/ControlsPalette.m +++ b/Applications/Gorm/Palettes/2Controls/ControlsPalette.m @@ -64,11 +64,24 @@ - (void) finishInstantiate { 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 addItemWithTitle: @"Item #0"]; [_prototypePopUp addItemWithTitle: @"Item #1"]; [_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]; AUTORELEASE(_prototypePopUp); diff --git a/Applications/Gorm/Palettes/2Controls/GormPopUpButtonAttributesInspector.m b/Applications/Gorm/Palettes/2Controls/GormPopUpButtonAttributesInspector.m index ad7c24af..e4648ee1 100644 --- a/Applications/Gorm/Palettes/2Controls/GormPopUpButtonAttributesInspector.m +++ b/Applications/Gorm/Palettes/2Controls/GormPopUpButtonAttributesInspector.m @@ -78,8 +78,13 @@ [object setPullsDown: pullsDown]; while ((o = [en nextObject]) != nil) { + id mi = nil; + [object addItemWithTitle: [o title]]; - } + mi = [object lastItem]; + [mi setAction: NULL]; // @selector(_popUpItemAction:)]; + [mi setTarget: nil]; + } } else if (sender == autoenableSwitch) {