Beispiel #1
0
        //---------------------------------------------------------------------
        // ConnectEvents gets only called from Window and Frame

        public void ConnectEvents(Window parent)
        {
            this.parent = parent;

            if (eventListeners.Count > 0)
            {
                foreach (MenuListener ml in eventListeners)
                {
                    parent.AddCommandListener(Event.wxEVT_COMMAND_MENU_SELECTED, ml.id, ml.listener, ml.owner);
                }
            }

            eventsconnected = true;
        }
Beispiel #2
0
        //---------------------------------------------------------------------

        public void AddEvent(int inId, EventListener el, Object owner)
        {
            // This is the only way of handling menu selection events (maybe there is an other solution)
            // But for now we have to add the EventListener to the EventHandler of the invoking window,
            // otherwise nothing happens.
            // As long as we do not have an invoking window, which means, that for example the
            // MenuBar of this Menu isn't connected to a Frame, the EventListener gets only
            // added to the ArrayList, otherwise it gets directly added to the EventHandler of
            // the invoking window. When Frame.MenuBar is set, it will call ConnectEvents()
            // for each Menu in MenuBar
            eventListeners.Add(new MenuListener(inId, el, owner));

            if (eventsconnected)
            {
                parent.AddCommandListener(Event.wxEVT_COMMAND_MENU_SELECTED, inId, el, owner);
            }
        }