sometimes when activating a command button, you need to disable the stop another or more command buttons
" " <summary> " "button is sensitive" " </summary> " " <param name= "Btnname" >button Name</param> " " <returns><c>true</c>if sensitive (not masked),<c>false</c>otherwise.</returns> Public FunctionGetmenubuttonsensitivity (ByValBtnname as String) as Boolean DimMenubtn asNXOpen.MenuBar.MenuButton =NXOpen.UI.GetUI (). Menubarmanager.getbuttonfromname (Btnname)IfMenubtnIsNot Nothing Then ReturnMenubtn.buttonsensitivity =MenuButton.SensitivityStatus.SensitiveEnd If Return False End Function " " <summary> " "Set button sensitive state" " </summary> " " <param name= "Btnname" >button Name</param> " " <param name= "issensitivity" >sensitive (not shielded)</param> Public SubSetmenubuttonsensitivity (ByValBtnname as String,ByValIssensitivity as Boolean) DimMenubtn asNXOpen.MenuBar.MenuButton =NXOpen.UI.GetUI (). Menubarmanager.getbuttonfromname (Btnname)IfMenubtnIsNot Nothing Thenmenubtn.buttonsensitivity=If(issensitivity, MenuButton.SensitivityStatus.Sensitive, MenuButton.SensitivityStatus.Insensitive)End If End Sub " " <summary> " "Take NX lock status" " </summary> " " <returns><c>true</c>if locked (all buttons are blocked),<c>false</c>otherwise.</returns> Public FunctionGetnxlockstatus () as Boolean ReturnNXOpen.UI.GetUI (). Asklockstatus () =NXOpen.UI.Status.LockEnd Function " " <summary> " "Set NX lock status" " </summary> " " <param name= "Islock" >if locked (all buttons are masked), set to<c>true</c> .</param> Public SubSetnxlockstatus (ByValIslock as Boolean) IfIslock ThenNXOpen.UI.GetUI (). Lockaccess ()ElseNXOpen.UI.GetUI (). Unlockaccess ()End If End Sub
VB. NET code
/// <summary>///button is sensitive/// </summary>/// <param name= "Btnname" >button Name</param>/// <returns><c>true</c>if sensitive (not masked),<c>false</c>otherwise.</returns> Public BOOLGetmenubuttonsensitivity (stringbtnname) {NXOpen.MenuBar.MenuButton menubtn=NXOpen.UI.GetUI (). Menubarmanager.getbuttonfromname (Btnname); if(Menubtn! =NULL) { returnMenubtn.buttonsensitivity = =MenuButton.SensitivityStatus.Sensitive; } return false;}/// <summary>///Set button sensitive state/// </summary>/// <param name= "Btnname" >button Name</param>/// <param name= "issensitivity" >sensitive (not shielded)</param> Public voidSetmenubuttonsensitivity (stringBtnname,BOOLissensitivity) {NXOpen.MenuBar.MenuButton menubtn=NXOpen.UI.GetUI (). Menubarmanager.getbuttonfromname (Btnname); if(Menubtn! =NULL) {menubtn.buttonsensitivity= issensitivity?MenuButton.SensitivityStatus.Sensitive:MenuButton.SensitivityStatus.Insensitive; }}/// <summary>///Take NX lock status/// </summary>/// <returns><c>true</c>if locked (all buttons are blocked),<c>false</c>otherwise.</returns> Public BOOLGetnxlockstatus () {returnNXOpen.UI.GetUI (). Asklockstatus () = =NXOpen.UI.Status.Lock;}/// <summary>///Set NX lock status/// </summary>/// <param name= "Islock" >if locked (all buttons are masked), set to<c>true</c> .</param> Public voidSetnxlockstatus (BOOLIslock) { if(Islock) {NXOpen.UI.GetUI (). Lockaccess (); } Else{NXOpen.UI.GetUI (). Unlockaccess (); }}
C # code
NX Screen button for window