/// <summary>Writes the data on the pane with the specified index.</summary> /// <param name="paneIdx">Pane index</param> /// <param name="info">Info to to shown on status bar</param> public void UpdatePaneContent(int paneIdx, string info) { if (_paneObjectsCollection.ContainsKey(paneIdx)) { //get the pane object. MgControlBase paneObj = _paneObjectsCollection[paneIdx]; if (paneObj != null) { switch (paneObj.Type) { case MgControlType.CTRL_TYPE_SB_IMAGE: //Show icon in image pane paneObj.SetAndRefreshDisplayValue(info, info == null, false); break; case MgControlType.CTRL_TYPE_SB_LABEL: //write the message to pane paneObj.setProp(PropInterface.PROP_TYPE_TEXT, info); paneObj.getProp(PropInterface.PROP_TYPE_TEXT).RefreshDisplay(true, 0); break; default: Debug.Assert(false); break; } Commands.beginInvoke(); } } }
/// <summary> /// Top /// </summary> /// <param name="control"></param> /// <param name="properties"></param> static void BuildTopProperty(MgControlBase control, Dictionary <string, DesignerPropertyInfo> properties) { if (AddNavigationProperties(control)) { int value = control.getProp(PropInterface.PROP_TYPE_TOP).CalcTopValue(control); String keyName = (control.Type == MgControlType.CTRL_TYPE_LINE ? Constants.WinPropY1 : Constants.WinPropTop); CreateCoordinateDesignerPropertyInfo(keyName, control, properties, value); } }
/// <summary> /// Writes tool tip to the specified pane. /// </summary> /// <param name="paneIdx">Pane idx</param> /// <param name="toolTipText">tool tip text</param> public void UpdatePaneToolTip(int paneIdx, string toolTipText) { MgControlBase pane = getPane(paneIdx); if (pane != null) { pane.setProp(PropInterface.PROP_TYPE_TOOLTIP, toolTipText); pane.getProp(PropInterface.PROP_TYPE_TOOLTIP).RefreshDisplay(false); } }
/// <summary> /// Width /// </summary> /// <param name="control"></param> /// <param name="properties"></param> static void BuildWidthProperty(MgControlBase control, Dictionary <string, DesignerPropertyInfo> properties) { if (AddNavigationProperties(control)) { int value = -1; if (control.Type == MgControlType.CTRL_TYPE_SUBFORM && control.getProp(PropInterface.PROP_TYPE_AUTO_FIT).getValueInt() == (int)AutoFit.AsCalledForm && control.GetSubformMgForm() != null) { MgFormBase subformForm = control.GetSubformMgForm(); value = subformForm.getProp(PropInterface.PROP_TYPE_WIDTH).CalcWidthValue(control); } else { value = control.getProp(PropInterface.PROP_TYPE_WIDTH).CalcWidthValue(control); } String keyName = (control.Type == MgControlType.CTRL_TYPE_LINE ? Constants.WinPropX2 : Constants.WinPropWidth); CreateCoordinateDesignerPropertyInfo(keyName, control, properties, value); } }
/// <summary> /// get the value for the specified property. If the property does not exist, get default value /// without creating the property object /// </summary> /// <param name="control"></param> /// <param name="propId"></param> /// <param name="isDefaultValue"></param> /// <returns></returns> private static string GetRuntimeValueAsString(MgControlBase control, int propId, ref bool isDefaultValue) { Property prop = null; if (!control.PropertyExists(propId)) { isDefaultValue = true; } else { prop = control.getProp(propId); } return(prop != null?prop.getValue() : string.Empty); }
/// <summary> /// predicate for open subforms /// </summary> /// <param name="ctrl"></param> /// <returns></returns> private bool IsSubformWithTask(MgControlBase ctrl) { bool isLoadTask = (ctrl.Type == MgControlType.CTRL_TYPE_SUBFORM && (SubformType)ctrl.getProp(PropInterface.PROP_TYPE_SUBFORM_TYPE).getValueInt() != SubformType.None); // QCR #177047. If the subform is visible or it's RefreshWhenHidden is 'Y' load the subform task. if (isLoadTask && !ctrl.isVisible() && !ctrl.checkProp(PropInterface.PROP_TYPE_REFRESH_WHEN_HIDDEN, false)) { // QCR #282991. // It related to nested subforms. When the parent subform is invisible and it's RefreshWhenHidden = Y, // we load the parent subform. But the nested subform is loaded according its RefreshWhenHidden property. // If the nested subform has no visibility expression, so we load it together with its parent (RefreshWhenHidden property doesn't affect). // If the nested subform has a visibility expression, so we do not load this subform (RefreshWhenHidden = No). // In this case the subform is loaded when its control becomes visible or by SubformRefresh event. // QCR #315894. The subform may become visible also if it has such a parent control as a group control, a tab control, a combo box. Property visibleProperty = ctrl.getProp(PropInterface.PROP_TYPE_VISIBLE); if (ctrl.hasContainer() || ctrl.getLinkedParent(false) != null || visibleProperty.isExpression()) { isLoadTask = false; } } return(isLoadTask); }
/// <summary> /// Refresh the text property of all the StatusPanes. /// </summary> public void RefreshPanes() { foreach (KeyValuePair <int, MgControlBase> obj in _paneObjectsCollection) { MgControlBase paneControl = obj.Value; switch (paneControl.Type) { case MgControlType.CTRL_TYPE_SB_LABEL: paneControl.getProp(PropInterface.PROP_TYPE_TEXT).RefreshDisplay(true, 0); break; default: Debug.Assert(false); break; } } Commands.beginInvoke(); }
/// <summary> /// /// </summary> /// <param name="control"></param> /// <param name="properties"></param> static void BuildVisibleProperty(MgControlBase control, Dictionary <string, DesignerPropertyInfo> properties) { bool isDefaultvalue = false; bool value = true; bool runtimeValue = true; // value is always "true", unless defined otherwise in previous runtime designer executions if (control.PropertyExists(PropInterface.PROP_TYPE_VISIBLE)) { Property prop = control.getProp(PropInterface.PROP_TYPE_VISIBLE); value = !prop.IsDesignerValue(); runtimeValue = GetRuntimeValueAsBool(control, PropInterface.PROP_TYPE_VISIBLE, ref isDefaultvalue); } properties.Add(Constants.WinPropVisible, new DesignerPropertyInfo() { VisibleInPropertyGrid = false, Value = value, IsDefaultValue = false, IsNativeProperty = false, RuntimeValue = runtimeValue }); }
/// <summary> /// </summary> /// <param name = "mgform"></param> internal void ApplyDefault(MgFormBase mgform) { // if is a main window if (!mgform.isSubForm() && !mgform.IsChildWindow) { mgform.getProp(PropInterface.PROP_TYPE_WIDTH).RefreshDisplay(true); mgform.getProp(PropInterface.PROP_TYPE_HEIGHT).RefreshDisplay(true); mgform.startupPosition(); // positions x,y mgform.getProp(PropInterface.PROP_TYPE_STARTUP_MODE).RefreshDisplay(true); } // restore width/height of frames in framesets if (mgform.IsFrameSet) { List <MgControlBase> frameSetCtrls = mgform.getCtrls(MgControlType.CTRL_TYPE_FRAME_SET); foreach (MgControlBase frameset in frameSetCtrls) { var widthList = new List <int>(); var heightList = new List <int>(); foreach (MgControlBase childCtrl in frameset.getLinkedControls()) { widthList.Add(childCtrl.getProp(PropInterface.PROP_TYPE_WIDTH).getValueInt()); heightList.Add(childCtrl.getProp(PropInterface.PROP_TYPE_HEIGHT).getValueInt()); } Commands.addAsync(CommandType.SET_FRAMES_WIDTH, frameset, 0, widthList); Commands.addAsync(CommandType.SET_FRAMES_HEIGHT, frameset, 0, heightList); // execute layout of the frameset Commands.addAsync(CommandType.EXECUTE_LAYOUT, frameset, true); } } // restore order of columns in table if (mgform.isLineMode()) { var columnData = new List <int>(); // {layer} List <MgControlBase> columnCtrls = mgform.getColumnControls(); for (int idx = 0; idx < columnCtrls.Count; idx++) { MgControlBase columnCtrl = columnCtrls[idx]; columnCtrl.getProp(PropInterface.PROP_TYPE_WIDTH).RefreshDisplay(true); columnData.Add(idx); } Commands.addAsync(CommandType.RESTORE_COLUMNS, mgform.getTableCtrl(), 0, columnData); } // apply default of all subforms (if any). List <MgControlBase> subformCtrls = mgform.getCtrls(MgControlType.CTRL_TYPE_SUBFORM); if (subformCtrls.Count > 0) { foreach (MgControlBase subformControl in subformCtrls) { MgFormBase subformForm = subformControl.GetSubformMgForm(); if (subformForm != null) { ApplyDefault(subformForm); } } } }