On Mon, Nov 12, 2012 at 1:25 PM, <Amphitryon@ok.de> wrote:

Hi Mike
 
happy that with your simple example program symbolic IDs now work
at last almost as expected I tried to modify one insertItem() just
as test to have menu items with different names as the
corresponding methods. ...
 
  - connect                     .true (as I assume the system
                                menu is already attached to a dialog, even I build a sub-menu,
so the connection may be done immediately. I read the paragraphs
about connection request and autoconnection, but I assume
autoconnection may not work here as the text of the menu entry and
the method name are different.


The documentation says about the connect argument:

connect
Whether to automatically connect the command item to a method in the owning dialog. This is
a connection request type of connection

Then the link to connection request says:

A connection request is made when a menu command item is to be connected to a specific
method name in a dialog, before the menu bar has been attached to a dialog. Obviously it is
impossible to connect the item to a dialog method, before it is known what dialog the menu bar
is going to be connected to. All connection requests are fulfilled the first time the menu bar is
connected to a dialog.

So, a .SystemMenu is not a .MenuBar.  

Which implies that a using a connection request here will never be fulfilled, because there is no MenuBar involved.

You need to do something similar to:

  popup~insertItem(IDM_PASTE, IDM_PASTE, 'put put')

  popup~insertItem(IDM_PASTE, IDM_COPY, "Copy")
  popup~insertItem(IDM_PASTE, IDM_CUT, "Cut")

  sysMenu~insertPopup(SC_MOVE, IDM_MENU_EDIT, popup, "Edit")
  sysMenu~insertSeparator(SC_MOVE, IDM_SEPARATOR)

  itemIDs = .set~of(IDM_COPY, IDM_CUT)
  sysMenu~connectSomeCommandEvents(itemIDs)

  sysMenu~connectCommandEvent(IDM_PASTE, 'Paste')

 

The insertItem() executes with RC=1 what is described as normal if
there is no error (for me it's not, for me RC=0 is OK),

The insertItem() method is not documented to return a return code, it is documented  to return .true or .false.  It returns .true on success and .false on error.

if \ sysMenu~connectCommandEvent(IDM_PASTE, 'Paste') then do
    -- handle the error.
end

--
Mark Miesfeld