[Pythonmac-SIG] PythonLauncher - first stab available

Ian McLaury ianjones@purgatory.healthmedia.umich.edu
Wed, 31 Jul 2002 09:33:51 -0400


At 10:49 AM +0200 7/31/02, Jack Jansen wrote:
>Yes, it should go. Together with "Print" and a couple of other ones. 
>But I have no idea yet how to remove these, there doesn't seem to be 
>a way to disable them in IB, and I haven't yet figured out how to 
>use the automatic-menu-enabling API.

Open MainMenu.nib in IB, click once on (say) the File menu to open 
it, once on (say) the New item to select it, and press the delete key.

[..]
>  *if* we get option-clicking to work. I still have no idea how to proceed.

In your application delegate, implement the application:openFile: 
method. From the application parameter, get the current event and 
check for the option key ('NSAlternateKeyMask'). eg:

- (BOOL)application:(NSApplication *)theApplication 
openFile:(NSString *)filename {
     if (([[anApplication currentEvent] modifierFlags] & 
NSAlternateKeyMask) == 0) {
         // might also check for whether app is launching if that's important

         // handle file open here
         // ...
     }
     return YES;
}

Warning, I just typed this into my mailer. There's more info in a 
cocoa-dev thread starting here:
http://cocoa.mamasam.com/COCOADEV/2002/02/1/25098.php

Ian