• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Annoying lack of behavior with NSMenu and Modal dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Annoying lack of behavior with NSMenu and Modal dialog


  • Subject: Annoying lack of behavior with NSMenu and Modal dialog
  • From: Stéphane Sudre <email@hidden>
  • Date: Thu, 7 Nov 2002 15:32:57 +0100

I have a NSTextField (used as a label) within a NSPanel which is run in Modal Dialog mode.

Attached to this NSTextField is a NSMenu. This NSMenu contains a NSMenuItem with one target and an action.

Both the target and action exists.

When I control-click on the menu, the menu item is disabled as if the action was not found.

----

I made a simple test case where I have one nib with:

- 1 NSWindow with a NSButton
- 1 NSPanel with a NSTextField
- 1 NSMenu with one menu item

I have one controller named MyController with:

2 outlets:

dialog_ connected to the NSPanel
window_ connected to the NSWindow

1 action:

showDialog:

The NSButton is connected to MyController:showDialog
The NSTextField menu outlet is connected to the NSMenu
The NSMenuItem of the NSMenu is connected to the (NSWindow(window_).miniaturize

The code is really complex:

#import <Cocoa/Cocoa.h>

@interface MyController : NSObject
{
IBOutlet id dialog_;
IBOutlet id window_;
}
- (IBAction)showDialog:(id)sender;
@end

#import "MyController.h"

@implementation MyController

- (IBAction)showDialog:(id)sender
{
[NSApp runModalForWindow:dialog_];
}

@end

When I click on the NSButton, the dialog appears
When I control-click on the NSTextField, the NSMenu appears but the NSMenuItem is disabled.

If I add a NSTextField (titled "here it works") to the NSWindow and link its menu outlet to the NSMenu, when I control-click on "here it works", the NSMenuItem is enabled and the action is working.

I did make tests to see whether I needed to add a validateMenuSomething code. Same result.
I did make tests to see what happens when I disabled the Auto-enabled feature. The action of the NSMenuItem when called from the NSPanel is not taken into action.



So the question is: am I missing something or is it a bug in the AppKit?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Move a file to the Trash
  • Next by Date: Re: To all cocoa developers - new cocoa dev forum
  • Previous by thread: Follow-up: Score view
  • Next by thread: [ot] To all cocoa dev...
  • Index(es):
    • Date
    • Thread