/// <summary> /// Get ancestor task containing form /// </summary> /// <returns>TaskBase</returns> public TaskBase GetAncestorTaskContainingForm() { TaskBase parentTask = (TaskBase)GetTaskAncestor(1); while (parentTask != null && parentTask.getForm() == null) { parentTask = (TaskBase)parentTask.GetTaskAncestor(1); } return(parentTask); }
/// <summary>get a field from the task.travel by parents (i.e. NOT by triggering tasks).</summary> /// <param name = "parent">generation number (0 is current task)</param> /// <param name = "fldIdx">the field index within its task</param> /// <returns> the id of the field described by parent + idx</returns> public virtual FieldDef getField(int parent, int fldIdx) { switch (parent) { case 0: return(getField(fldIdx)); case MAIN_PRG_PARENT_ID: // find the main program using the component id (ctl idx) TaskBase compMainProg = (TaskBase)Manager.MGDataTable.GetMainProgByCtlIdx(ContextID, _ctlIdx); return(compMainProg.getField(fldIdx)); default: parent--; if (StudioParentTask != null) { return(StudioParentTask.getField(parent, fldIdx)); } return(null); } }
/// <summary> /// initialize the current task's form. /// </summary> public virtual ITask InitForm() { TaskBase nonInteractiveTask = null; if (Form != null) { Form.InInitForm = true; Form.init(); if (Form.getSubFormCtrl() != null) { Commands.addAsync(CommandType.SUSPEND_LAYOUT, Form.getSubFormCtrl().getParent(), true); //QCR #449743, show subform after all controls are displayed Commands.addAsync(CommandType.PROP_SET_VISIBLE, Form.getSubFormCtrl(), 0, false, !Form.IsFirstRefreshOfProps()); } SetRefreshType(Form.hasTree() ? Constants.TASK_REFRESH_TREE_AND_FORM : Constants.TASK_REFRESH_FORM); Form.InitFormBeforeRefreshDisplay(); RefreshDisplay(); Form.arrangeZorder(); Form.fixTableLocation(); Form.createPlacementLayout(); if (!IsInteractive && !_isMainPrg) { nonInteractiveTask = this; } #if !PocketPC if (!IsSubForm) { String iconFileNameTrans; iconFileNameTrans = IconFileName != null?Events.Translate(IconFileName) : "@Mgxpa"; //After #984822, Gui.low expects the local file path if (!iconFileNameTrans.StartsWith("@")) { iconFileNameTrans = Events.GetLocalFileName(iconFileNameTrans, this); } Commands.addAsync(CommandType.PROP_SET_ICON_FILE_NAME, Form, 0, iconFileNameTrans, 0); } #endif if (Form.getSubFormCtrl() == null) { // calculation the height of the form should include the menu and toolbar height. // this must be executed after menu and toolbar create, and before the layout executed Property heightProperty = Form.GetComputedProperty(PropInterface.PROP_TYPE_HEIGHT); if (heightProperty != null) { heightProperty.RefreshDisplay(true); } } else { // subform if (CanResumeSubformLayout()) { ResumeSubformLayout(false); } } if (Form.getContainerCtrl() != null) { Commands.addAsync(CommandType.RESUME_LAYOUT, Form.getContainerCtrl(), false); } Commands.beginInvoke(); Form.InInitForm = false; } return(nonInteractiveTask); }