/// <summary> /// Open message box with title id and message id that will take from MGBCL*ENG.xml (created by mgconst) /// </summary> /// <param name = "form"></param> /// <param name = "titleId">message from from MGBCL*ENG.xml</param> /// <param name = "msgId">message from from MGBCL*ENG.xml</param> /// <param name = "style">the style of the message box can be flags of Styles.MSGBOX_xxx </param> /// <returns> message box style from Styles.MSGBOX_XXX</returns> internal int writeToMessageBox(MgForm form, string titleId, string msgId, int style) { String title = ClientManager.Instance.getMessageString(titleId); String msg = ClientManager.Instance.getMessageString(msgId); return(Commands.messageBox(form.getTopMostForm(), title, msg, style)); }
/// <summary> Catch the enable/disable of the soft keyboard. When the keyboard state changes, /// resize the active form and scroll to the control in focus /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void inputPanel_EnabledChanged(object sender, EventArgs e) { // Get the active form ClientManager cm = ClientManager.Instance; tasks.Task task = cm.getLastFocusedTask(); if (task == null) { return; } MgForm mgForm = (MgForm)cm.getLastFocusedTask().getForm(); if (mgForm == null) { return; } mgForm = (MgForm)mgForm.getTopMostForm(); Form form = GuiCommandQueue.getInstance().mgFormToForm(mgForm); // If form size changed if (form != null && form.Bounds != _inputPanel.VisibleDesktop) { Size changeFormSizeTo; if (_inputPanel.Enabled || _previousSize == null) { // remember the form's size before the soft keyboard was opened _previousSize = form.Size; changeFormSizeTo = _inputPanel.VisibleDesktop.Size; } else { // use the size from before the soft keyboard was opened - the VisibleDesktop ignores // the menu bar size changeFormSizeTo = _previousSize; } // Set the new size. The .Net way of changing the bounds does not work in this case, // so lets do it via win32 functions NativeWindowCommon.SetWindowPos(form.Handle, IntPtr.Zero, 0, 0, changeFormSizeTo.Width, changeFormSizeTo.Height, NativeWindowCommon.SWP_NOMOVE | NativeWindowCommon.SWP_NOZORDER); // Find the control in focus and scroll to it MapData mapData = ((TagData)form.Tag).LastFocusedMapData; GuiMgControl guiMgcontrol = mapData.getControl(); if (guiMgcontrol == null) { return; } object o = ControlsMap.getInstance().object2Widget(guiMgcontrol, mapData.getIdx()); Control control = null; LogicalControl logicalControl = null; if (o is LogicalControl) { logicalControl = (LogicalControl)o; control = logicalControl.getEditorControl(); } else { control = (Control)o; } GuiUtils.scrollToControl(control, logicalControl); } }