/// <summary> /// The menu texts needs to be refreshed due to a change in the language. /// </summary> private void RefreshMenusText() { int ctlIdx = 0; Task mainProg = (Task)MGDataCollection.Instance.GetMainProgByCtlIdx(ctlIdx); while (mainProg != null) { ApplicationMenus menus = Manager.MenuManager.getApplicationMenus(mainProg); // call refreshMenuesTextMls for each application menu of components, starting with the main. if (menus != null) { menus.refreshMenuesTextMls(); } ctlIdx = mainProg.getCtlIdx(); mainProg = (Task)mainProg.getMGData().getNextMainProg(ctlIdx); } }
/// <summary> /// This method is activated when an Event menu was selected. It performs the needed operations in order to /// translate the selected event menu into the matching operation /// </summary> /// <param name = "menuEntryEvent">the selected menu \ bar menuEntryEvent object</param> /// <param name = "activeForm">last active Form</param> /// <param name = "ctlIdx">the index of the ctl which the menu is attached to in toolkit</param> internal static void onEventMenuSelection(MenuEntryEvent menuEntryEvent, MgForm activeForm, int ctlIdx) { MgControl lastFocusedControl = getLastFocusedControl(activeForm); Task task = getLastFocusedTask(activeForm); RunTimeEvent aRtEvt = new RunTimeEvent(menuEntryEvent, task, lastFocusedControl, ctlIdx); aRtEvt.setPublicName(); aRtEvt.setMainPrgCreator(null); // build the argument list from the mainProgVars List <String> mainProgVars = menuEntryEvent.MainProgVars; if (mainProgVars != null && mainProgVars.Count > 0) { ArgumentsList argList = new ArgumentsList(); argList.fillListByMainProgVars(mainProgVars, task.getCtlIdx()); aRtEvt.setArgList(argList); aRtEvt.setTask(null); } ClientManager.Instance.EventsManager.addToTail(aRtEvt); }
/// <summary> /// get the next task in the tasks chain and returns false if no task was found. /// this function changes the phase variable accordingly /// </summary> private bool goUpTaskChain() { MGData mgd = _task.getMGData(); int ctlIdx = _task.getCtlIdx(); //handlers for events for .NET object must be in the same task (not including control) if (_rtEvt.DotNetObject != null) { if (_phase != PHASE_CONTROL_NON_SPECIFIC) //QCR #940545, check only the same tasks { _phase++; //go to the next phase return(true); } else { return(false); } } switch (_phase) { /*case PHASE_CONTROL_SPECIFIC: * phase = PHASE_CONTROL_NON_SPECIFIC; * break;*/ case PHASE_CONTROL_SPECIFIC: case PHASE_CONTROL_NON_SPECIFIC: // non specific handlers are searched till we hit our main program (inclusive) // afterwards we switch to global phase. if (!_task.isMainProg()) { getParentOrCompMainPrg(); break; } else { // internal, internal, system and user events may cross component bounderies if ((_rtEvt.getType() == ConstInterface.EVENT_TYPE_PUBLIC || _rtEvt.getType() == ConstInterface.EVENT_TYPE_INTERNAL || _rtEvt.getType() == ConstInterface.EVENT_TYPE_SYSTEM || _rtEvt.getType() == ConstInterface.EVENT_TYPE_USER) && ctlIdx != 0) { // load the RT parent of the previous task. If no prevtask exists then we are // simply running on the main progs list (for example, when a main prg catches // a timer event, no prevtask exists. if (_prevTask == null) { _task = (Task)mgd.getNextMainProg(ctlIdx); if (_task == null && ctlIdx != 0) { _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0)); } } else { // the component main program that was set in getParentOrCompMainPrg, is now replaced back to the path parent. _task = _prevTask.PathParentTask; _prevTask = null; } _rtEvt.setMainPrgCreator(null); //moving out of a main program to another task break; } // here we scan the main progs according to the load sequence (first to last). if (_phase == PHASE_CONTROL_SPECIFIC) { // specific search is over. start the non specific search from // the first task. _phase = PHASE_GLOBAL_SPECIFIC; } else { // here we scan the main progs according to the load sequence (first to last). _phase = PHASE_GLOBAL; } _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0)); _rtEvt.setMainPrgCreator(_task); if (_task == null) { return(false); } break; } case PHASE_GLOBAL_SPECIFIC: case PHASE_GLOBAL: _task = (Task)mgd.getNextMainProg(ctlIdx); if (_task == null) { if (_phase == PHASE_GLOBAL) { return(false); } // PHASE_GLOBAL_SPECIFIC else { // specific search is over. start the non specific search from // the first task. _phase = PHASE_CONTROL_NON_SPECIFIC; _task = _orgTask; _prevTask = _orgPrevTask; break; } } break; default: Logger.Instance.WriteExceptionToLog("in EventHandlerPosition.goUpTaskChain() invalid phase: " + _phase); break; } if (_task == null) { return(false); } _handlersTab = _task.getHandlersTab(); if (_handlersTab == null) { return(goUpTaskChain()); } _handlerIdx = -1; return(true); }