No submenus in PP LStdPopupMenu...?

No submenus in PP LStdPopupMenu...?

Post by David Phillip Ost » Tue, 07 Oct 1997 04:00:00




>In my LStdPopupMenu, why does no submenu appear for menu items
>that are in fact defined to have submenus?  (I.e., when
>the cursor reaches the item with the submenu-triangle,
>no submenu appears.)

>Is this because:
>  a) The standard CDEF just doesn't do this for popup menus
>     so I'll have to write my own CDEF or MDEF?

the standard CDEF just calls PopUpMenuSelect, with a menuhandle.
You set which MDEF runs the menu when you create the menu. The
default MDEF does support submenus.

Quote:>  b) Power Plant just doesn't do this for popup menus

Well, there are two problems, but it isn't powerplant's fault.

1.) Powerplant wants you to enable the items that are roots of
hierarchical menus, generally.

For an ordinaray menu, Powerplant disables all the items, and
calls FindCommandStatus() on each menu item to see if anything
in the current command hierachy is prepared to handle the menu
item. Something must enable the commandItem you've assigned to
the root of the hierarchical menu, or the hierarchical menu will
stay disabled. (You did assign a command number to the root of
the hierarchical, didn't you?)

2.) It is futile to use a hierachical menu tree with LStdPopupMenu
because it just calls the system popup menu CDEF, which is a
control, so its value is represented by ::GetControlValue(), which
returns a short int. To use hierachical menus, you need something
that can pass back to you the long int that ::PopUpMenuSelect()
returns. You can define your own LPane derivative, that looks
like a LStdPopupMenu but behaves differently when you click.
(in fact, you can just override the ClickSelf
message of LStdPopupMenu in your own subclass of it, and let its
draw method do most of the work)

just use the method LStdPopupMenu::GetMenuHandle(), and call
PopUpMenuSelect youself, and set the value appropriately in your
object.

Also, double check that you've wired up your menu and submenus
correctly. I use the following in my .r files:

resource 'MENU' (kEditMenu, "Edit") {
   kEditMenu,
   textMenuProc,
   kAllItems - (kItem3 | kItem9 | kItem11 | kItem13),
   enabled,
   "Edit",
   {
   /* [1] */   "Undo", noIcon, "Z", noMark, plain,
   /* [2] */   "Redo", noIcon, "R", noMark, plain,
   /* [3] */   "-", noIcon, noKey, noMark, plain,
   /* [4] */   "Cut", noIcon, "X", noMark, plain,
   /* [5] */   "Copy", noIcon, "C", noMark, plain,
   /* [7] */   "Paste", noIcon, "V", noMark, plain,
   /* [8] */   "Clear", noIcon, noKey, noMark, plain,
   /* [9] */   "-", noIcon, noKey, noMark, plain,
   /* [10] */  "Select All", noIcon, "A", noMark, plain,
   /* [11] */  "-", noIcon, noKey, noMark, plain,
   /* [12] */  "Orientation", noIcon, hierarchicalMenu,
                              $$format("%c",kOrientationMenu), plain,
   /* [13] */  "-", noIcon, noKey, noMark, plain,
   /* [14] */  kProgramS " Preferences?", noIcon, noKey, noMark, plain

Quote:}};

resource 'Mcmd' (kEditMenu, "Edit") {{
   cmd_Undo,
   cmd_Redo,
   cmd_Nothing,
   cmd_Cut,
   cmd_Copy,
   cmd_Paste,
   cmd_Clear,
   cmd_Nothing,
   cmd_SelectAll,
   cmd_Nothing,
   cmd_U*uItem,  // root of hierachical menu.
   cmd_Nothing,
   cmd_Preferences

Quote:}};

--
-- Warning: posted from an unlocked cubicle: no guarantee its really me.
   "I'm so busy doing what I must do that I don't have time to do what I ought
to do ... and I never get a chance to do what I _want_ to do!"
   "Son, that's universal. The way to keep that recipe from killing you is
occasionally to do what you want to do anyhow." -- Robert Heinlein (CitizenOTG.)
 
 
 

1. No Submenus in PP LStdPopupMenu...?

OK, PowerPlant newbie question:

In my LStdPopupMenu, why does no submenu appear for menu items
that are in fact defined to have submenus?  (I.e., when
the cursor reaches the item with the submenu-triangle,
no submenu appears.)

Is this because:
  a) The standard CDEF just doesn't do this for popup menus
     so I'll have to write my own CDEF or MDEF?
  b) Power Plant just doesn't do this for popup menus
  c) No, it should work, something else must be wrong

Any help would be appreciated, but do drop the SPAMLESS if emailing.

2. NonDEC laser printers for DEC systems?

3. LStdPopupMenu with submenu items fails

4. "operation cannot be performed"

5. SubMenus under appearance manager...

6. DBD::Oracle multiple SQL statements - PL/SQL example

7. powerplant adding/creating submenu

8. The terminal server has ended the connection

9. How to get submenu selection?

10. how do I activate submenu'ed apple menu?

11. Can popup menus have submenus?

12. Difficulties with using a Carbon MDEF as a PowerPlant submenu

13. submenus from a popup menu