Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            ControlsMap controlsMap = ControlsMap.getInstance();
            Control     control     = (Control)sender;
            MapData     mapData     = controlsMap.getMapData(control);

            if (mapData == null)
            {
                return;
            }

            Type    senderType = sender.GetType();
            ListBox listBox    = (ListBox)sender;

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(mapData.getControl()));

            try
            {
                switch (type)
                {
                case EventType.MOUSE_DOWN:
                    MouseEventArgs mouseEvtArgs = (MouseEventArgs)e;
                    GuiUtils.SaveLastClickInfo(mapData, (Control)sender, new Point(mouseEvtArgs.X, mouseEvtArgs.Y));
                    bool leftClickWasPressed = (((MouseEventArgs)e).Button == MouseButtons.Left);
                    GuiUtils.SetOnClickOnTagData(control, leftClickWasPressed);

#if !PocketPC
                    if (leftClickWasPressed)
                    {
                        GuiUtils.AssessDrag(control, (MouseEventArgs)e, mapData);
                    }
#endif

                    return;

                case EventType.MOUSE_UP:
                case EventType.GOT_FOCUS:
                case EventType.LOST_FOCUS:
                    GuiUtils.SetOnClickOnTagData(control, false);

#if !PocketPC
                    if (type == EventType.MOUSE_UP)
                    {
                        GuiUtils.ResetDragInfo(control);
                    }
#endif
                    return;

                case EventType.KEY_DOWN:
                    if (OnkeyDown(type, sender, e))
                    {
                        return;
                    }
                    break;

                case EventType.CLICK:
                    // we do not want the process selection to accure here. only in SelectedIndexChanged.
                    return;
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }

            DefaultHandler.getInstance().handleEvent(type, sender, e);
        }
Esempio n. 2
0
        /// <summary>
        /// remove rows from table control
        /// </summary>
        /// <param name="rowStart">the index at which to begin remove</param>
        /// <param name="rowsToRemove">number of rows to remove</param>
        internal override void RemoveRows(int rowStart, int rowsToRemove, bool manipulateEditors)
        {
            int numOfRows = _tableControl.getItemsCount();

            if (rowStart < 0 || rowStart >= numOfRows && rowsToRemove <= 0)
            {
                return;
            }

            if (rowStart + rowsToRemove > numOfRows)
            {
                rowsToRemove = numOfRows - rowStart;
            }

            _mgCount -= rowsToRemove;

            for (int idx = rowStart; idx < rowStart + rowsToRemove; idx++)
            {
                _tableControl.RemoveItem(getGuiRowIndex(rowStart));
            }

            if (manipulateEditors)
            {
                // if allowTesting, do not perform remove, use shiftrows instead.
                if (GuiUtils.AccessTest)
                {
                    ShiftEditors(rowStart, -rowsToRemove);
                }
                else
                {
                    RemoveEditorsForVisibleColumns(rowStart, rowsToRemove);
                }
            }

            // update controlsMap
            for (int i = 0; i < _children.Count; i++)
            {
                if (!_children[i].IsTableHeaderChild)
                {
                    ArrayList arrayControl = controlsMap.object2WidgetArray(_children[i], GuiConstants.ALL_LINES);

                    // lg.Dispose() can remove entries from controlsMap and hence arrayControl can be null.
                    // In that case no need to continue even for other columns in same row.
                    if (arrayControl == null)
                    {
                        break;
                    }

                    for (int idx = 0; idx < rowsToRemove && rowStart < arrayControl.Count; idx++)
                    {
                        long           entriesBeforeDispose = arrayControl.Count;
                        LogicalControl lg = (LogicalControl)arrayControl[rowStart] ?? null;
                        if (lg != null)
                        {
                            // As we delete entries from arrayControl, we should adjust _mgRow in
                            // logical controls. _mgRow is used as index to remove Control from map
                            lg._mgRow = rowStart;
                            lg.Dispose();
                        }

                        // LogicalControl.Dispose removes entry from the map only all entries after current
                        // entry are null. If Dispose has not removed the entry, then remove it.
                        if (entriesBeforeDispose == arrayControl.Count)
                        {
                            arrayControl.RemoveAt(rowStart);
                        }
                    }

                    for (int j = rowStart; j < arrayControl.Count; j++)
                    {
                        LogicalControl lg = (LogicalControl)arrayControl[j] ?? null;
                        if (lg != null)
                        {
                            lg._mgRow = j;
                            ((TableCoordinator)lg.Coordinator).MgRow = j;

                            TableEditor editor = getTableEditor(lg);
                            // reapply properties on the editor
                            if (editor != null && editor.Control != null)
                            {
                                TagData tagData = (TagData)(((Control)editor.Control).Tag);
                                if (tagData.MapData is MapData)
                                {
                                    MapData mapData = (MapData)tagData.MapData;
                                    int     row     = mapData.getIdx();
                                    row = j;
                                    mapData.setIdx(row);
                                }
                            }
                        }
                    }
                }
            }

            // remove from _rowsToRefresh
            for (int idx = rowStart; idx < rowStart + rowsToRemove; idx++)
            {
                if (_rowsToRefresh.Contains(getGuiRowIndex(rowStart)))
                {
                    _rowsToRefresh.Remove(getGuiRowIndex(rowStart));
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// insert rows into table control
        /// </summary>
        /// <param name="rowStart">the index at which to begin insert</param>
        /// <param name="rowsToInsert">number of rows to be inserted</param>
        internal override void InsertRows(int rowStart, int rowsToInsert, bool manipulateEditors)
        {
            if (rowStart < 0 || rowsToInsert <= 0)
            {
                return;
            }

            _mgCount += rowsToInsert;

            for (int idx = rowStart; idx < rowStart + rowsToInsert; idx++)
            {
                _tableControl.InsertItem(getGuiRowIndex(rowStart));
            }

            if (manipulateEditors)
            {
                // if allowTesting, do not perform insert, use shiftrows instead.
                if (GuiUtils.AccessTest)
                {
                    ShiftEditors(rowStart, rowsToInsert);
                }
                else
                {
                    InsertEditorsForVisibleColumns(rowStart, rowsToInsert);
                }
            }

            // move rows after rowStart in controlsMap
            for (int i = 0; i < _children.Count; i++)
            {
                if (!_children[i].IsTableHeaderChild)
                {
                    ArrayList arrayControl = controlsMap.object2WidgetArray(_children[i], GuiConstants.ALL_LINES);

                    if (arrayControl == null)
                    {
                        break;
                    }

                    if (rowStart <= arrayControl.Count)
                    {
                        for (int idx = rowStart; idx < rowStart + rowsToInsert; idx++)
                        {
                            arrayControl.Insert(rowStart, null);
                        }
                    }

                    for (int j = rowStart + rowsToInsert; j < arrayControl.Count; j++)
                    {
                        LogicalControl lg = (LogicalControl)arrayControl[j] ?? null;
                        if (lg != null)
                        {
                            lg._mgRow = j;
                            ((TableCoordinator)lg.Coordinator).MgRow = j;

                            TableEditor editor = getTableEditor(lg);
                            // reapply properties on the editor
                            if (editor != null && editor.Control != null)
                            {
                                TagData tagData = (TagData)(((Control)editor.Control).Tag);
                                if (tagData.MapData is MapData)
                                {
                                    MapData mapData = (MapData)tagData.MapData;
                                    int     row     = mapData.getIdx();
                                    row = j;
                                    mapData.setIdx(row);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary> handle the context of a control
        ///
        /// </summary>
        /// <param name="widget">:
        /// is the widget of the control \ tab \ table
        /// </param>
        /// <param name="ctrl">
        /// </param>
        public void handleContext(Control control, GuiMgControl guiMgControl, GuiMgForm guiMgForm)
        {
            ControlsMap      controlsMap  = ControlsMap.getInstance();
            GuiMgMenu        contextMenu  = null;
            ContextMenuStrip menu         = null;
            ContextMenuStrip prevMenu     = control.ContextMenuStrip;
            GuiMgForm        controlsForm = guiMgForm;


            if (guiMgControl != null)
            {
                // save the form that holds the control.
                if (guiMgControl.isSubform())
                {
                    controlsForm = guiMgForm;
                }
                else
                {
                    controlsForm = guiMgControl.GuiMgForm;
                }

                contextMenu = Events.OnGetContextMenu(guiMgControl);

                Form    form    = GuiUtils.FindForm(control);
                MapData mapData = controlsMap.getFormMapData(form);
                guiMgForm = mapData.getForm();
            }
            else
            {
                contextMenu = Events.OnGetContextMenu(guiMgForm);
            }

            if (contextMenu != null)
            {
                MenuReference menuRefernce = contextMenu.getInstantiatedMenu(guiMgForm, MenuStyle.MENU_STYLE_CONTEXT);
                menu = (ContextMenuStrip)controlsMap.object2Widget(menuRefernce);
            }


            // Fix bug#:927653, problem #2, when set context menu to the control need to refresh the event on the context menu
            // because on MgForm :instatiatedMenus is one per form per style (the style is the key) and it keeps only the menu
            // created for the last child of the form.
            // Qcr #909188 : Use the controlsForm to refresh menus action and not the 'form' which might be topmost.
            // The reason is that the form sent to OnRefreshMenuActions has to point to the task that holds the
            // control because it holds the relevant 'Action manager'. An action enabled for the control , might be disabled
            // in the top most form's task and be wrongly disabled in the context menu.
            if (controlsForm != null)
            {
                Events.OnRefreshMenuActions(contextMenu, controlsForm);
            }

            if (menu != prevMenu)
            {
                GuiUtils.setContextMenu(control, menu);
                //Save the control on which context menu is invoked. This is required later for creating dummy context menu.
                if (menu != null)
                {
                    ((TagData)menu.Tag).MouseDownOnControl = control;
                }
            }
        }
Esempio n. 5
0
        /// <summary>handle dotnet event of .NET control</summary>
        /// <param name="eventName"></param>
        /// <param name="sender"></param>
        /// <param name="eventArgs"></param>
        /// <param name="mapData"></param>
        internal void handleEvent(String eventName, object sender, EventArgs eventArgs, MapData mapData)
        {
            GuiMgControl mgControl = null;

            if (mapData != null)
            {
                mgControl = mapData.getControl();
            }

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(mgControl));

            Events.OnDotNetEvent(sender, mgControl, eventName, new Object[] { sender, eventArgs });
            contextIDGuard.Dispose();
        }
Esempio n. 6
0
        /// <summary></summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="evtArgs"></param>
        internal override void handleEvent(EventType type, Object sender, EventArgs evtArgs)
        {
            ControlsMap controlsMap = ControlsMap.getInstance();
            Control     ctrl        = (Control)sender;
            MapData     mapData     = controlsMap.getMapData(ctrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl mgControl = mapData.getControl();
            MgLinkLabel  linkLabel = ctrl as MgLinkLabel;

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(mgControl));

            try
            {
                if (linkLabel != null)
                {
                    switch (type)
                    {
                    case EventType.LINK_CLICKED:
                        LinkLabelLinkClickedEventArgs args = (LinkLabelLinkClickedEventArgs)evtArgs;
#if !PocketPC
                        if (args.Button == MouseButtons.Left)
#endif
                        // Mobile: we get here only with a left button click
                        OnLinkClicked(linkLabel, controlsMap, mapData, mgControl, true);
                        return;

                    case EventType.GOT_FOCUS:
                    case EventType.MOUSE_UP:
                        break;

                    case EventType.MOUSE_DOWN:
                        if (!linkLabel.Focused)
                        {
                            GuiUtils.saveFocusingControl(GuiUtils.FindForm(linkLabel), mapData);
                        }

                        break;

                    case EventType.MOUSE_ENTER:
                        linkLabel.OnHovering = true;
                        break;

                    case EventType.MOUSE_LEAVE:
                        linkLabel.OnHovering = false;
                        break;

                    case EventType.KEY_DOWN:
                        KeyEventArgs keyEventArgs = (KeyEventArgs)evtArgs;

                        if (KbdConvertor.isModifier(keyEventArgs.KeyCode))
                        {
                            return;
                        }

                        if (keyEventArgs.Modifiers == Keys.None && keyEventArgs.KeyCode == Keys.Space)
                        {
                            OnLinkClicked(linkLabel, controlsMap, mapData, mgControl, false);
                            return;
                        }
                        break;

                    case EventType.PRESS:
                        if (!linkLabel.Focused)
                        {
                            GuiUtils.saveFocusingControl(GuiUtils.FindForm(linkLabel), mapData);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }


            DefaultHandler.getInstance().handleEvent(type, sender, evtArgs);
        }
Esempio n. 7
0
 /// <summary>on click</summary>
 /// <param name="controlsMap"></param>
 /// <param name="ctrl"></param>
 /// <param name="mapData"></param>
 /// <param name="mgControl"></param>
 /// <param name="linkLabel"></param>
 private static void OnLinkClicked(MgLinkLabel linkLabel, ControlsMap controlsMap, MapData mapData, GuiMgControl mgControl, bool produceClick)
 {
     Events.OnSelection(GuiUtils.getValue(linkLabel), mgControl, mapData.getIdx(), produceClick);
 }
Esempio n. 8
0
        /// <summary> </summary>
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            TableControl table        = (TableControl)sender;
            TableManager tableManager = GuiUtils.getTableManager(table);

            if (tableManager == null)
            {
                return;
            }

            switch (type)
            {
            case EventType.PAINT_ITEM:
                tableManager.PaintRow((TablePaintRowArgs)e);
                return;

            case EventType.ERASE_ITEM:
                return;

            case EventType.SCROLL:
                if (((ScrollEventArgs)e).ScrollOrientation == ScrollOrientation.VerticalScroll)
                {
                    tableManager.ScrollVertically((ScrollEventArgs)e);
                }
                return;

#if PocketPC
            case EventType.RESIZE:
                tableManager.resize();
                tableManager.PerformLayout(sender, e);
                break;
#endif

            case EventType.LAYOUT:
                if (((LayoutEventArgs)e).AffectedControl == sender)
                {
#if !PocketPC
                    //Defer the resizing of table until the form is in resize mode.
                    //Resize doesn't mean resizing the table itself but it actually
                    //means post-resize stuff like creating new rows, fetching data, etc.
                    Form parent = GuiUtils.FindForm(table);

                    // Parent can be null, when we just created a control and before attaching parent, we reset its size.
                    if (parent != null)
                    {
                        TagData tagData = (TagData)parent.Tag;
                        if (!tagData.IgnoreWindowResizeAndMove)
                        {
                            tableManager.resize();
                        }
                    }
#else
                    tableManager.resize();
#endif
                }
                return;

            case EventType.MOUSE_DOWN:
                bool leftClickWasPressed = ((MouseEventArgs)e).Button == MouseButtons.Left;

#if !PocketPC
                if (leftClickWasPressed)
                {
                    MapData mapData = tableManager.HitTest(new Point(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y), false, true);
                    if (mapData != null)
                    {
                        int       row       = mapData.getIdx();
                        Modifiers modifiers = GuiUtils.getModifier(Control.ModifierKeys);
                        // Defect 124555. Copy from Gui_Table.cpp LButtonDown_On_Table: for click on a table with AllowDrag
                        // with rows selected and the click on the selected row do not put MUTI_MARK_HIT action.
                        if (row >= 0 && !(((TagData)table.Tag).AllowDrag && tableManager.IsInMultimark && tableManager.IsItemMarked(row)))
                        {
                            Events.OnMultiMarkHit(ControlsMap.getInstance().getMapData(sender).getControl(), row + 1, modifiers);
                        }
                    }
                }
#endif
                break;

            case EventType.REORDER_STARTED:
                TableReorderArgs ea = (TableReorderArgs)e;
                tableManager.reorder(ea.column, ea.NewColumn);
                break;

            case EventType.REORDER_ENDED:
                tableManager.refreshPage();
                break;

            case EventType.DISPOSE_ITEM:
                tableManager.cleanItem(((TableItemDisposeArgs)e).Item);
                return;

            case EventType.HORIZONTAL_SCROLL_VISIBILITY_CHANGED:
                tableManager.resize();
                return;
            }
            DefaultContainerHandler.getInstance().handleEvent(type, sender, e);
        }
Esempio n. 9
0
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            ControlsMap controlsMap = ControlsMap.getInstance();
            UtilImeJpn  utilImeJpn  = Manager.UtilImeJpn;

            TextBox textCtrl = (TextBox)sender;
            int     start;
            int     end;

            MapData mapData = controlsMap.getMapData(textCtrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl guiMgCtrl = mapData.getControl();
            GuiMgForm    guiMgForm = mapData.getForm();

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(guiMgCtrl));

            if (Events.ShouldLog(Logger.LogLevels.Gui))
            {
                Events.WriteGuiToLog("TextBoxHandler(\"" + mapData.getControl().getName(mapData.getIdx()) + "\"): " + type);
            }

            try
            {
                switch (type)
                {
                case EventType.GOT_FOCUS:
                    // check the paste enable. check the clip content.
                    if (mapData != null)
                    {
                        GuiUtils.checkPasteEnable(mapData.getControl(), true);
                        GuiUtils.SetFocusColor(textCtrl);
                    }
                    break;

                case EventType.LOST_FOCUS:
                    // Always disable paste when exiting a text ctrl. (since we might be focusing on a diff type of
                    // ctrl).
                    if (mapData != null)
                    {
                        GuiUtils.disablePaste(mapData.getControl());
                        GuiUtils.ResetFocusColor(textCtrl);
                    }
                    break;

                case EventType.KEY_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    return;

                case EventType.KEY_DOWN:
                    KeyEventArgs keyEventArgs = (KeyEventArgs)e;

                    if (ShouldBeHandledByTextBox(textCtrl, keyEventArgs))
                    {
                        GuiUtils.checkAutoWide(mapData.getControl(), textCtrl, GuiUtils.getValue(textCtrl));
                        keyEventArgs.Handled = false;
                        return;
                    }
                    break;

                case EventType.IME_EVENT:
                    // (Korean) IME messages (WM_IME_COMPOSITION, etc.) are handled as pseudo-input
                    // where action=MG_ACT_CHAR, text=" ".
                    // To distinguish with real " ", ImeParam im is attached to RuntimeEvent.
                    ImeEventArgs iea = (ImeEventArgs)e;
                    start = textCtrl.SelectionStart;
                    end   = textCtrl.SelectionStart + textCtrl.SelectionLength;
                    Events.OnKeyDown(guiMgForm, guiMgCtrl, Modifiers.MODIFIER_NONE, 0, start, end, " ", iea.im, true, "-1", false, iea.Handled);
                    iea.Handled = true;
                    break;

                case EventType.KEY_PRESS:
                    KeyPressEventArgs keyPressEventArgs = (KeyPressEventArgs)e;
                    // skipp control key
                    if (Char.IsControl(keyPressEventArgs.KeyChar))
                    {
                        return;
                    }

                    start = textCtrl.SelectionStart;
                    end   = textCtrl.SelectionStart + textCtrl.SelectionLength;
                    String pressedChar = "" + keyPressEventArgs.KeyChar;

                    // flag the isActChar to indicate this is MG_ACT_CHAR
                    Events.OnKeyDown(guiMgForm, guiMgCtrl, Modifiers.MODIFIER_NONE, 0, start, end, pressedChar, true, "-1", keyPressEventArgs.Handled);
                    keyPressEventArgs.Handled = true;
                    break;

                case EventType.MOUSE_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    break;

                case EventType.CUT:
                    Events.CutEvent(mapData.getControl());
                    return;

                case EventType.COPY:
                    Events.CopyEvent(mapData.getControl());
                    return;

                case EventType.PASTE:
                    Events.PasteEvent(mapData.getControl());
                    return;

                case EventType.CLEAR:
                    Events.ClearEvent(mapData.getControl());
                    return;

                case EventType.UNDO:
                    Events.UndoEvent(mapData.getControl());
                    return;



                case EventType.STATUS_TEXT_CHANGED:
                    // JPN: ZIMERead function
                    if (utilImeJpn != null && sender is MgTextBox && !utilImeJpn.IsEditingCompStr((Control)sender))
                    {
                        utilImeJpn.StrImeRead = ((MgTextBox)sender).GetCompositionString();
                    }
                    return;
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }

            DefaultHandler.getInstance().handleEvent(type, sender, e);
        }
Esempio n. 10
0
        /* (non-Javadoc)
         * @see org.eclipse.swt.widgets.Handler#handleEvent(org.eclipse.swt.widgets.Event)
         */
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            ControlsMap controlsMap  = ControlsMap.getInstance();
            RichTextBox richTextCtrl = (RichTextBox)sender;
            MapData     mapData      = controlsMap.getMapData(richTextCtrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl ctrl      = mapData.getControl();
            GuiMgForm    guiMgForm = mapData.getForm();

            UtilImeJpn utilImeJpn = Manager.UtilImeJpn; // JPN: IME support

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(ctrl));

            try
            {
                switch (type)
                {
                case EventType.GOT_FOCUS:
                    // check the paste enable. check the clip content.
                    if (mapData != null)
                    {
                        GuiUtils.checkPasteEnable(mapData.getControl(), true);
                    }

                    // For RichEdit Ctrl, Set AcceptButton(i.e. DefaultButton) to null in order to allow enter key on RichEdit control.
                    if (sender is MgRichTextBox)
                    {
                        Form form = GuiUtils.FindForm(richTextCtrl);
                        form.AcceptButton = null;

                        if (((MgRichTextBox)sender).ReadOnly)
                        {
                            GuiUtils.restoreFocus(form);
                        }
                    }
                    break;

                case EventType.LOST_FOCUS:
                    // Always disable paste when exiting a text ctrl. (since we might be focusing on a diff type of
                    // ctrl).
                    if (mapData != null)
                    {
                        GuiUtils.disablePaste(mapData.getControl());
                    }
                    break;

                case EventType.KEY_UP:
                    // Korean
                    if (sender is MgRichTextBox && ((MgRichTextBox)sender).KoreanInterimSel >= 0)
                    {
                        return;
                    }

                    if (utilImeJpn != null)
                    {
                        if (utilImeJpn.IsEditingCompStr(richTextCtrl)) // JPN: IME support
                        {
                            return;
                        }

                        if (richTextCtrl is MgRichTextBox)           // JPN: ZIMERead function
                        {
                            utilImeJpn.StrImeRead = ((MgRichTextBox)richTextCtrl).GetCompositionString();
                        }
                    }

                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    return;

                case EventType.KEY_DOWN:
                    // Korean
                    if (sender is MgRichTextBox && ((MgRichTextBox)sender).KoreanInterimSel >= 0)
                    {
                        return;
                    }

                    if (utilImeJpn != null && utilImeJpn.IsEditingCompStr(richTextCtrl)) // JPN: IME support
                    {
                        return;
                    }

                    KeyEventArgs keyEventArgs = (KeyEventArgs)e;
                    // marking the text (next/prev char or beg/end text) we let the
                    // system to take care of it.
                    // why ? There is no way in windows to set the caret at the beginning of
                    // a selected text. it works only on multi mark for some reason.
                    // also posting a shift+key does not work well since we have no way of knowing
                    // if the shift is already pressed or not.
                    // *** ALL other keys will continue to handleEvent.
                    if ((keyEventArgs.Shift && (keyEventArgs.KeyCode == Keys.Left || keyEventArgs.KeyCode == Keys.Right || keyEventArgs.KeyCode == Keys.Up || keyEventArgs.KeyCode == Keys.Down || keyEventArgs.KeyCode == Keys.Home || keyEventArgs.KeyCode == Keys.End)) ||
                        (keyEventArgs.Control && (keyEventArgs.KeyCode == Keys.Left || keyEventArgs.KeyCode == Keys.Right)))
                    {
                        keyEventArgs.Handled = false;
                        return;
                    }
                    break;

                case EventType.KEY_PRESS:

                    KeyPressEventArgs keyPressEventArgs = (KeyPressEventArgs)e;

                    bool IgnoreKeyPress = ((TagData)richTextCtrl.Tag).IgnoreKeyPress;
                    // should we ignore the key pressed ?
                    if (IgnoreKeyPress)
                    {
                        ((TagData)richTextCtrl.Tag).IgnoreKeyPress = false;

                        return;
                    }

                    // skipp control key
                    if (Char.IsControl(keyPressEventArgs.KeyChar))
                    {
                        return;
                    }

                    int start = richTextCtrl.SelectionStart;
                    int end   = richTextCtrl.SelectionStart + richTextCtrl.SelectionLength;

                    String pressedChar = "" + keyPressEventArgs.KeyChar;

                    // flag the isActChar to indicate this is MG_ACT_CHAR
                    Events.OnKeyDown(guiMgForm, ctrl, Modifiers.MODIFIER_NONE, 0, start, end, pressedChar, true, "-1", keyPressEventArgs.Handled);

                    // keyPressEventArgs.Handled wii stay 'false' in order to let the system put the correct char.
                    // What will happen is 2 things : 1. processKeyDown will add 'MG_ACT_CHAR'. 2. The system will write the char.
                    // In the past, the 'ACT_CHAR' was using sendKeys in order to write the char, but it makes problems in multilanguage systems.
                    // So, in TextMaskEditor for rich , ACT_CHAR will do nothing, just pass there in order to rais the 'control modify'.
                    //keyPressEventArgs.Handled = true;
                    break;

                case EventType.MOUSE_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    break;
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }

            DefaultHandler.getInstance().handleEvent(type, sender, e);
        }