Professional Web Applications Themes

Quit menu item - Mac Programming

I'm having troubles with something that should be trivial in my opinion: MacOS X automatically adds a "quit" menu item for my carbon application, but unfortunately it is disabled. As described in Carbon Porting Guide, I tried using EnableMenuCommand(nil,'quit') to manually enable this menu item, but it still remains disabled! My app does support the quit AppleEvent. What am I doing wrong? Any hints? Thanks, Sven...

  1. #1

    Default Quit menu item

    I'm having troubles with something that should be trivial in my opinion:

    MacOS X automatically adds a "quit" menu item for my carbon application,
    but unfortunately it is disabled.
    As described in Carbon Porting Guide, I tried using
    EnableMenuCommand(nil,'quit') to manually enable this menu item, but it
    still remains disabled!
    My app does support the quit AppleEvent.

    What am I doing wrong? Any hints?

    Thanks,
    Sven
    Sven Guest

  2. #2

    Default Re: Quit menu item

    On Sat, 8 Nov 2003, Sven Mumenthaler wrote:
     

    You don't have an event handler for the event
    {kEventClassCommand,kEventCommandUpdateStatus} do you?

    Fred 

    Frederick Guest

  3. #3

    Default Re: Quit menu item

    > > I'm having troubles with something that should be trivial in my opinion: 
    >
    > You don't have an event handler for the event
    > {kEventClassCommand,kEventCommandUpdateStatus} do you?[/ref]

    I do have an AppleEvent handler:

    error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
    NewAEEventHandlerUPP(HandleQuitAE), 0, false);

    Do I need to use Carbon Events? I thought I could keep using the old
    event model (to minimize porting effort)?

    Sven
    Sven Guest

  4. #4

    Default Re: Quit menu item

    In article <ethz.ch>,
    Sven Mumenthaler <ch> wrote:
     
    > >
    > > You don't have an event handler for the event
    > > {kEventClassCommand,kEventCommandUpdateStatus} do you?[/ref]
    >
    > I do have an AppleEvent handler:
    >
    > error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
    > NewAEEventHandlerUPP(HandleQuitAE), 0, false);
    >
    > Do I need to use Carbon Events? I thought I could keep using the old
    > event model (to minimize porting effort)?[/ref]

    Your AE handler should handle the quit event, but that doesn't affect
    the enabled state of the menu item. In other word, if you write an
    AppleScript that tells your application to quit, your AE handler will
    get called. But to have the Quit item enabled, you still need to enable
    it. I'd guess that if you call EnableMenuCommand, Carbon expects that
    you'll handle command status events for that command as well. If you
    enable the menu item (rather than the command), perhaps that'll work.
    But you might as well write an update status handler; it'll only take a
    few minutes and won't affect any of your existing event handling code.

    -Eric

    --
    Eric Albert edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

  5. #5

    Default Re: Quit menu item

    In article <stanford.edu>,
    Eric Albert <edu> wrote:
     
    > >
    > > I do have an AppleEvent handler:
    > >
    > > error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
    > > NewAEEventHandlerUPP(HandleQuitAE), 0, false);
    > >
    > > Do I need to use Carbon Events? I thought I could keep using the old
    > > event model (to minimize porting effort)?[/ref]
    >
    > Your AE handler should handle the quit event, but that doesn't affect
    > the enabled state of the menu item. In other word, if you write an
    > AppleScript that tells your application to quit, your AE handler will
    > get called. But to have the Quit item enabled, you still need to enable
    > it. I'd guess that if you call EnableMenuCommand, Carbon expects that
    > you'll handle command status events for that command as well. If you
    > enable the menu item (rather than the command), perhaps that'll work.
    > But you might as well write an update status handler; it'll only take a
    > few minutes and won't affect any of your existing event handling code.[/ref]

    Thanks a lot for all the hints! Now it's finally working!

    The only thing I needed to do is to call EnabeMenuCommand more than once
    (in fact, every time I update my menus). I don't even need to install a
    carbon event handler, the AEEventHandler works well.

    Thanks,
    Sven
    Sven Guest

Similar Threads

  1. Menu Item - Problem - Help!
    By AJ in forum ASP.NET Building Controls
    Replies: 2
    Last Post: August 9th, 09:51 AM
  2. Heading not showing up in styles menu and Contributecrash on quit
    By lemp555 in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: July 4th, 08:04 AM
  3. create new sub-menu item....how???
    By bradfordcity in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: May 13th, 08:36 PM
  4. How get root item in menu bar
    By dragonmagik in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 2nd, 08:53 PM
  5. Add new Item on Pop Up Menu
    By Pierrick_Chantrel@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: April 2nd, 02:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139