protected override void PrepareMessageBoxForDisplay(tasks.Task task, ref string mlsTransTitle, ref int style) { mlsTransTitle = ClientManager.Instance.getLanguageData().translate(_title); style = Operation.getButtons(_buttonsID); style |= Operation.getImage(_image); style |= Operation.getDefaultButton(_defaultButton); if (task != null) { // Verify command return value can only be used with main program fields if (Task.isMainProgramField(_returnValStr)) { _returnVal = Operation.InitField(_returnValStr, task); } } }
/// <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); } }