realbasic-nug
[Top] [All Lists]

COMMAND+DELETE for Menu CommandKey

To: realbasic-nug at lists dot realsoftware dot com
Subject: COMMAND+DELETE for Menu CommandKey
From: Chase <xanadu at juun dot com>
Date: Wed, 31 Aug 2005 06:06:05 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Okay, there are tons of posts on this very subject in the archives, but they all skip the same couple of details.

I have a menu called "Node". In it I have an item called "Delete" that has a kb-shortcut of command+delete. As I'm sure you already know, you cannot enter such a command key in the RB gui (using 5.5.5), so it has to be done via code, but simply setting the CommandKey property to chr(8) doesn't so the trick:

nodedelete.commandkey = chr(8)


...so carbon declares have to be used.

I have the following code culled from the list archives, but there are two pieces missing that I'll need help with:


  // the menu is simply called "Menu"
  // the "Node" menu is called "NodeMenu"
// and the item in NodeMenu that we're setting here is called "NodeDelete"

  dim themenuhandle as integer

  #if targetCarbon then

Declare Sub SetMenuItemKeyGlyph Lib "CarbonLib" ( theMenu as integer, item as integer, mark as integer ) Declare Function GetMenuHandle Lib "CarbonLib" ( menuID as integer ) as integer

    themenuhandle = GetMenuHandle( ????????? )
    if themenuhandle <> 0 then
      SetMenuItemKeyGlyph themenuhandle, ?????????, 10
    end

  #endif



... where do i get the "menuID" to send to GetMenuHandle()?

... and what about the second parameter to SetMenuItemKeyGlyph()?


Thanks.

- Chase




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>