cmenupalm-osgarnet-os

Using system's standard Edit menu in a Palm OS app


How can I use the standard Edit menu in my Palm OS application, instead of having to implement my own Cut/Copy/Paste/Keyboard handlers?


Solution

  • Palm OS's system form code had built-in handlers for the command IDs in the Edit menu. If you use a standard form for these menus, you have the advantage of not needing to write code and being compatible with system extensions that look for this particular menu construction.

    If your form has a menubar that consists of just the "Edit" menu, you can specify menu ID 10000 at form creation time.

    If your form has a menubar with several menus, you should specify your Edit menu like this, using PilRC notation:

    PULLDOWN "Edit"
    BEGIN
      MENUITEM "Undo" ID 10000 "U"
      MENUITEM "Cut" ID 10001 "X"
      MENUITEM "Copy" ID 10002 "C"
      MENUITEM "Paste" ID 10003 "P"
      MENUITEM "Select All" ID 10004 "S"
      MENUITEM "-" ID 10005
      MENUITEM "Keyboard" ID 10006 "K"
      MENUITEM "Grafitti Help" ID 10007 "G"
    END
    

    If you're using Constructor, you can use the "Create Edit Menu" command to add this menu to your resource file.