Strange refresh issue...

Topics related to the Krypton Ribbon.

Moderators: Phil Wright, Chris Porter

Strange refresh issue...

Postby Nataraj » Thu Sep 09, 2010 1:34 am

A strange refresh issue can be seen in the ribbon control. If the same ribbon group is added to two tabs and when the property on the ribbon button is changed programatically, the refresh happens only on the tab to which the group was added last. The following steps can be performed to reproduce this issue.

1) Open VS2008 and choose a Windows Forms Application
2) Create a Form.
3) Add references to the ribbon control.
4) Drag and drop the ribbon control from the toolbox onto the form.
5) Add two tabs to the control and set the text of the tabs as "Tab 1" and "Tab 2" respectively.
6) Create a ribbon group, add a triple and add three buttons with text as "Button 1", "Button 2" and "Button 3" respectively and add it to the first tab.
7) Add the same group created in Step 6 to the second tab.
8) Add a command button to the form and write code so as to toggle visibility of the first button in the group and set the visible property of the second button in the group to the opposite of the first button.
9) Run the form
10) Select the second tab and click on the command button, the group will now show only two buttons and on repeatedly clicking the command button the text on the button will display as "Button 1" and "Button 2". This happens everytime the button is clicked, this is because of the change in the visibility of the buttons.
11) Now select the first tab and click on the command button, you will not observe any change, select the second tab and then the first tab and the refresh happens and the change can be seen.

Based on the above steps it can be confirmed that only the tab to which the same group was added last will refresh and not the others.

Please look into the attached sample file. To run this, create a new solution in VS2008, add references to the ribbon control, add the form in the attached zip file, run the form and follow the steps 10 & 11.

Please let me know how to solve this issue.
Attachments
RibbonTest.zip
(3.12 KiB) Downloaded 8 times
Nataraj
 
Posts: 1
Joined: Wed Sep 08, 2010 11:13 pm

Re: Strange refresh issue...

Postby Phil Wright » Thu Sep 09, 2010 12:54 pm

You should not be adding the same element to more than a single tab. A ribbon group/button/checkbox etc etc are all designed to be added to exactly one place only. It will definitely not work correctly when adding twice. This is because the ribbon group etc will have a back reference to the owning element and send messages to it, such as it needs repainting. When adding in more than one place it means one of the parents is not getting this updates back from the element.

So you need to create a new instance of the group for each time you want to add a group to a tab.
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia


Return to Krypton Ribbon

Who is online

Users browsing this forum: No registered users and 2 guests