[futurebasic] Osx application menu

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2003 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sun, 16 Nov 2003 02:11:40 -0500
Michael Evans asked:

>Listers
>
>Hi....
>
>I would like to be able to disable/enable the Osx application menu under
>program control.
>
>MENU 1, 0,  disableable
>MENU 1, 0,  enable
>
>Don©–t work in panther...
>
>Actually all I need to do is disable the quit item...
>
>Can't find any documentation or example on this...
>
>All help, hints and pointers cheerfully accepted...


Michael:

Here are a few functions I've written that may 
point you in the right direction.

Ken

Please watch for e-mail line breaks and lost 
constant underscores on the Associate server.

// To disable the OS X "Quit" menu:

toolbox DisableMenuCommand (MenuRef inMenu,¬
                                MenuCommand inCommandI )

_kMenuItemAttrDisabled = (1 << 0)

DisableMenuCommand( _nil, _kHICommandQuit )


// To completely remove the OS X "Quit" menu:

local fn RemoveOSXQuitMenu
dim as MenuRef       @ applicationMenu
dim as MenuItemIndex @ outIndex
dim as OSErr           err

err = fn GetIndMenuItemWithCommandID( _nil,¬
                            _kHICommandQuit,¬
                         1, applicationMenu,¬
                                   outIndex )

long if err == _noErr
DeleteMenuItem( applicationMenu, outIndex )
end if

end fn