/// <summary> /// </summary> /// <param name = "enabled"> /// </param> /// <param name = "checkValidation:">to check the validation of the set value /// @return : error number if the method was faild. /// </param> /// <param name = "refresh">refresh will decide if gui refresh is to be performed or not. /// </param> public void setEnabled(bool enabled, bool checkValidation, bool checkEnableSystemAction, String checkForName, bool IsChildOfCheckForName, bool refresh) { if (checkValidation) { //bug #:293070 If MnuEnable () is called on menu, we should disable it's menu entries as well. (in online it is bug #:927017) if (menuType() == MenuType.MENU) { bool NewIsChildOfCheckForName = IsChildOfCheckForName || (checkForName == null) || (_name != null && _name.CompareTo(checkForName) == 0); for (int i = 0; i < ((MenuEntryMenu)this).subMenus.Count; i++) { MenuEntry subMenuEntry = (((MenuEntryMenu)this).subMenus[i]); subMenuEntry.setEnabled(enabled, checkValidation, checkEnableSystemAction, checkForName, NewIsChildOfCheckForName, refresh); } } if (checkEnableSystemAction && this is MenuEntryEvent) { MenuEntryEvent menuEntryEvent = (MenuEntryEvent)this; bool notAllowDisable = ((menuEntryEvent.menuType() == MenuType.INTERNAL_EVENT) && ((menuEntryEvent.InternalEvent < InternalInterface.MG_ACT_USER_ACTION_1) || (menuEntryEvent.InternalEvent > InternalInterface.MG_ACT_USER_ACTION_20))); if (notAllowDisable) { return; } } if (menuType() == MenuType.PROGRAM) { MenuEntryProgram mp = (MenuEntryProgram)this; if (mp.Idx <= 0) { enabled = false; } } else if (menuType() == MenuType.INTERNAL_EVENT) { MenuEntryEvent me = (MenuEntryEvent)this; if (me.InternalEvent == 0) { enabled = false; } } else if (menuType() == MenuType.USER_EVENT) { MenuEntryEvent me = (MenuEntryEvent)this; if (me.UserEvtIdx == 0) { enabled = false; } } } bool activateEanble = (menuType() == MenuType.MENU) || (checkForName == null) || (_name != null && _name.CompareTo(checkForName) == 0); // fixed bugs#:293070 & 754704, (as we doing for online in gui_mnut.cpp \EnableMenu() // when try to enale\disable menu entry item we need to set the comman type without to update the member Enable if (IsChildOfCheckForName) { if (refresh) { ICollection mnuRefs = getInstantiatedMenus(null, true, true, true); if (enabled) { //try to enable menu that is not enabled if (!_menuState.Enabled) { enabled = false; } } addAllRefsToCmdQueue(mnuRefs, CommandType.PROP_SET_ENABLE, enabled); } } else if (activateEanble) { if (!getModalDisabled()) { _menuState.Enabled = enabled; } if (refresh) { ICollection mnuRefs = getInstantiatedMenus(true); addAllRefsToCmdQueue(mnuRefs, CommandType.PROP_SET_ENABLE, enabled); } } }