/// <summary> /// send MG_ACT_ARROW_KEY to worker thread form key down,up,left,right /// we are handling those keys /// </summary> /// <param name = "mgControl"> </param> /// <param name = "modifier"> </param> /// <param name = "keyCode"> </param> /// <param name = "suggestedValue"> </param> /// <returns> true if need to ignore this action key</returns> private bool processKeyForSelectionControl(MgFormBase mgForm, MgControlBase mgControl, Modifiers modifier, int keyCode, String suggestedValue) { bool isSelectionKey = false; switch (keyCode) { case GuiConstants.KEY_DOWN: case GuiConstants.KEY_UP: isSelectionKey = true; break; case GuiConstants.KEY_RIGHT: case GuiConstants.KEY_LEFT: if (!mgControl.isListBox()) { isSelectionKey = true; } break; case GuiConstants.KEY_SPACE: if (mgControl.isRadio()) { isSelectionKey = true; } break; case GuiConstants.KEY_PG_DOWN: case GuiConstants.KEY_PG_UP: case GuiConstants.KEY_HOME: case GuiConstants.KEY_END: if (mgControl.isComboBox()) { isSelectionKey = true; } break; } if (isSelectionKey) { // raise event Manager.EventsManager.AddKeyboardEvent(mgForm, mgControl, modifier, keyCode, 0, 0, null, null, false, suggestedValue, InternalInterface.MG_ACT_ARROW_KEY); } return(isSelectionKey); }
/// <summary> /// /// </summary> /// <param name="control"></param> /// <param name="properties"></param> /// <param name="value"></param> private static void CreateCoordinateDesignerPropertyInfo(String keyName, MgControlBase control, Dictionary <string, DesignerPropertyInfo> properties, int value) { DesignerPropertyInfo DesignerPropertyInfo = new DesignerPropertyInfo(); DesignerPropertyInfo.Value = value; if (control.Type != MgControlType.CTRL_TYPE_LINE) { DesignerPropertyInfo.VisibleInPropertyGrid = (control.Type == MgControlType.CTRL_TYPE_LINE ? false : true); } if (control.isComboBox() && !control.isOwnerDrawComboBox() && (keyName == "Height")) { DesignerPropertyInfo.VisibleInPropertyGrid = false; } properties.Add(keyName, DesignerPropertyInfo); }
/// <summary>Pass keycode and modifier to bridge, bridge then converts it to keyboard action and adds in MgCore.dll /// events queue</summary> /// <param name="form"></param> /// <param name="guiMgCtrl"></param> /// <param name="modifier"></param> /// <param name="keyCode"></param> /// <param name="start"></param> /// <param name="end"></param> /// <param name="caretPos"></param> /// <param name="text"></param> /// <param name="im"></param> /// <param name="isActChar"></param> /// <param name="suggestedValue"></param> /// <param name="ComboIsDropDown"></param> /// <param name="handled">boolean variable event is handled or not.</param> /// <returns> true only if we have handled the KeyDown event (otherwise the CLR should handle). If true magic will handle else CLR will handle.</returns> protected virtual bool processKeyDown(GuiMgForm guiMgForm, GuiMgControl guiMgCtrl, Modifiers modifier, int keyCode, int start, int end, string text, ImeParam im, bool isActChar, string suggestedValue, bool ComboIsDropDown, bool handled) { bool eventHandled = handled; bool addKeyBoardEvent = true; MgControlBase mgControl = (MgControlBase)guiMgCtrl; MgFormBase mgForm = (MgFormBase)guiMgForm; if (mgControl != null) { //In case of help window, the events like up arrow\down arrow key, should be handled by the //CLR.So first check if the form is help form and return the value true or false. if (mgControl.getForm() != null && mgControl.getForm().IsHelpWindow&& keyCode != GuiConstants.KEY_ESC) { //events related with the help window will NOT be handled by magic. return(false); } // DOWN or UP invoked on a SELECT/RADIO control if ((mgControl.isRadio() || mgControl.isListBox() || (mgControl.isComboBox() && ComboIsDropDown) || (mgControl.isTabControl() && !suggestedValue.Equals("-1")))) { if (processKeyForSelectionControl(mgForm, mgControl, modifier, keyCode, suggestedValue)) { addKeyBoardEvent = false; } } } if (addKeyBoardEvent) { // raise event Manager.EventsManager.AddKeyboardEvent(mgForm, mgControl, modifier, keyCode, start, end, text, im, isActChar, suggestedValue, InternalInterface.MG_ACT_CTRL_KEYDOWN); } return(eventHandled); }