On Sun, Nov 18, 2012 at 6:05 PM, Art Heimsoth <artst...@artheimsoth.com>wrote:

> > So this could have been:
> >
> >
> > MYMENU_MENU MENUEX
>
> This did not work for me, nor did trying to use symbolic ID for the
> separator menuitem.
>

Art,

For it to work, the entire menu definition needs to use the MENUEX format.
 Since you are writing out the menu definition yourself, it is a simple
matter of using the correct format.

Here is a complete working example:

/* Very simple dialog with a menu.  simpleDlg.rex */

  .application~useGlobalConstDir("O", "simpleDlg.h")

  dlg = .SimpleDialog~new
  dlg~execute("SHOWTOP")

return 0

::requires "ooDialog.cls"

::class 'SimpleDialog' subclass UserDialog

::method init
  forward class (super) continue

  self~create(30, 30, 257, 140, "Simple Dialog", "CENTER")

::method defineDialog

  self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")
  self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")

::method initDialog
  expose menuBar

  menuBar = .ScriptMenuBar~new("simpleDlg.rc", MYMENU_MENU, , , .true, self)

::method cut unguarded
  expose menuBar

  menuBar~removeSeparator(MENU_SEP1)
  menuBar~removeSeparator(MENU_SEP2)


/* simpleDlg.rc */

MYMENU_MENU MENUEX
{
    POPUP "&File", MENU_FILE, 0, 0
    {
        MENUITEM "&Open", MENU_FILEOPEN, 0, 0
        MENUITEM "&New", MENU_FILENEW, 0, 0
        MENUITEM "&Save", MENU_FILESAVE, 0, MFS_GRAYED
        MENUITEM "&Saveas", MENU_FILESAVEAS, 0, MFS_GRAYED
        MENUITEM "", MENU_SEP1, MFT_SEPARATOR, 0
        MENUITEM "Recent", MENU_FILELAST1, 0, 0
    }
    POPUP "&Edit", MENU_EDIT, 0, 0
    {
        MENUITEM "&Copy", MENU_EDITCOPY, 0, 0
        MENUITEM "&Paste",  MENU_EDITPASTE, 0, MFS_GRAYED
        MENUITEM "Cu&t", MENU_EDITCUT, 0, 0
        MENUITEM "", MENU_SEP2, MFT_SEPARATOR, 0
        MENUITEM "&Settings", MENU_EDITSETTINGS, 0, 0
        MENUITEM "P&references", MENU_EDITPREFERENCES, 0, 0
    }
}

/* simpleDlg.h */

#define MYMENU_MENU                  1001
#define MENU_FILE                    1002
#define MENU_FILEOPEN                1003
#define MENU_FILENEW                 1004
#define MENU_FILESAVE                1005
#define MENU_FILESAVEAS              1006
#define MENU_SEP1                    1007
#define MENU_FILELAST1               1008
#define MENU_EDIT                    1009
#define MENU_EDITCOPY                1010
#define MENU_EDITPASTE               1011
#define MENU_EDITCUT                 1012
#define MENU_SEP2                    1013
#define MENU_EDITSETTINGS            1014
#define MENU_EDITPREFERENCES         1015


In the dialog code I only wrote a method for Cut.  When you open the
dialog, you can look at the menu and see the two separators.  Then if you
click on the Cut menu item, you can see the 2 separators get removed.

This URL leads to the MSD doc for the menuex format:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa381023(v=vs.85).aspx?ppud=4

If you look at the format specification, you will see that POPUP menu items
can also have a help ID.  You could do that like this:

    POPUP "&File", MENU_FILE, 0, 0, MENU_FILE_HELPID

where MENU_FILE_HELPID would be defined in the .h file.

In the above, the first 0 entry is where the MFT_x flags go.  The second 0
entry is where the MFS_x flags go.  To use more than 1 flag, you separate
each flag with the | symbol.

So, you could have something like:

MFS_GRAYED | MFS_CHECKED

--
Mark Miesfeld
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to