Hello,
I created a Ribbon and an UltraTabControl. The ribbon starts with all the buttons disabled
I'm trying to enable/disable a specific ribbon button ("Print Preview") in dependance of the selected tab
I used the property .SharedProps.Enabled = True, but it seems not working (the button remain disabled all the time). I already set this property StartForm.RibbonManager.Office2007UICompatibility = False
Private Sub TabControl1_SelectedTabChanged(sender As Object, e As SelectedTabChangedEventArgs) Handles TabControl1.SelectedTabChanged Dim PreviewButton As ButtonTool = StartForm.RibbonManager.Tools("Print Preview") StartForm.RibbonManager.Office2007UICompatibility = False Select Case e.Tab.Key Case Is = 1 PreviewButton.SharedProps.Enabled = True Case Else PreviewButton.SharedProps.Enabled = False End Select
.......
Thanks in advance for the help
BR
Alberto
Hi Alberto,
Thank you for posting in our forums.
I have tested this with the latest version of 14.2 and everything seems to work as expected – the button is either disabled or enabled based on the selected tab. What version are you using? Are you sure that the code goes through the call that enables the button?
Please provide me with a sample that reproduces the issue. I have attached the sample I used to test this, so that you can use it as a starting point.
I am looking forward to hearing from you.
Thanks Dimitar,
I see that your code is working, but it seems that there is something weird when I run mine
I'm sure that the code goes thru' (pls see attachment), the button stat seems to be enabled (as status) but it seems that the ribbon do not update the status (you can see from the attachment
(the app I'm working with is big so it's not easy to reproduce it)
Do you have any idea?
Thanks
Thank you for the reply.
The only suggestions I can think of that may cause this is if there is some code that reverts the value back to false after the select statement or if the tool that you enable is not the tool that you expect (I see from the screenshot that the captions match, but the keys maybe be different). In order to make sure that none of these things causes the issue you can change the caption:
Select Case e.Tab.Key
Case Is = 1
PreviewButton.SharedProps.Enabled = True
PreviewButton.SharedProps.Caption = "Button Enabled"
Case Else
PreviewButton.SharedProps.Enabled = False
PreviewButton.SharedProps.Caption = "Button Disabled”
End Select
If the caption changes then you are setting the enabled property on the correct button.
Also please add a button to the tab where the button should be enabled and in its click event check if the enabled property of the button is still true.
If you set the Enabled property on the correct tool and it is not reverted after this, I can’t really think of any other reason for the issue. Maybe you could copy your real project and strip all the parts that are unnecessary to reproduce the issue and send it to me. Then I will be able to identify what is the exact cause of the issue.
Thanks Dimitar
even if I add the caption property changing and even if the code is going thru' it, the ribbon does not move
In the same pont I also looped thru all the buttons in a msgbox, but it seems that it is the ribbon that do not update
I can send you the whole code, but I'd prefer not in a public area. Do you have an email address or similar where I can send a zip file?
Many thanks
I have created a private ticket for you - CAS-153877-N5H2V4 - in which you can share your code.
You can view your currently active cases if you follow this link:
https://www.infragistics.com/my-account/support-activity