![]() |
Saving and loading Ribbon customization |
Post Reply ![]() |
Author | |
dbenito ![]() Groupie ![]() Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() Posted: 11 October 2013 at 4:34am |
Is there any way to save only the ribbon customization, rather than the entire ribbon?
I have an application where the users can change the UI language, so when I create the ribbon in my code, I set the appropriate captions depending on the language selected by the user. I then use LoadCommandBars to load the ribbon customization from the registry. Unfortunately, this means that if the user changes the language, when I load the customizations from the registry, the correct captions are replaced by the captions in the previous UI language. In a previous version of this application, we got around this by using actions and resetting the captions of all of the actions after loading the customization. Unfortunately, when we transitioned to using the ribbon we found we needed to set different captions (shorter or longer) for the same actions depending on where they appeared, so this is no longer an option. I've tried using DoPropExchange with various different combinations of StateOptions, but it doesn't seem to work. Needless to say, there are no code examples for using DoPropExchange with the registry, and the ones for XML don't really show anything useful. Does anybody have any idea how to do this? Or maybe some kind of workaround I could use? Regards, Daniel
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows 8.1 (64bit) Language: Visual Basic 6.0 |
|
![]() |
|
Willowmaster ![]() Senior Member ![]() ![]() Joined: 12 July 2010 Location: Netherlands Status: Offline Points: 180 |
![]() ![]() ![]() ![]() ![]() |
I think you should not use the options SerializeControls And SerializeDesignerControls. Let me know if that's it. If not I have another suggestion which involves doing two times a propexchange. :)
|
|
Product: Xtreme SuitePro (ActiveX) version 15.3.1
Platform: Windows XP (32bit) - SP 3 (on VMWare) Language: Visual Basic 6.0 |
|
![]() |
|
dbenito ![]() Groupie ![]() Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() |
Can anybody provide a working example for using CreateAsRegistry? No matter what I try, it always returns false, so I can't actually properly test calling DoPropExchange. I have the feeling I got it to work the last time I tested this, but I did it in a test project which I no longer have.
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows 8.1 (64bit) Language: Visual Basic 6.0 |
|
![]() |
|
dbenito ![]() Groupie ![]() Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() |
OK, I got the CreateAsRegistry call to work. The problem now is that if I set the SerializeControls property of the StateOptions object to false, it doesn't save anything. If I set it to True, and I also set SaveOnlyCustomized to True, it still saves absolutely everything.
Basically, I want it to save any manual changes made by the end user to the ribbon or the QAB, but I don't want it to save any of the original information about the ribbon controls (captions, images, etc.) which may need to change from time to time. Is there really no way to do this?
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows 8.1 (64bit) Language: Visual Basic 6.0 |
|
![]() |
|
Willowmaster ![]() Senior Member ![]() ![]() Joined: 12 July 2010 Location: Netherlands Status: Offline Points: 180 |
![]() ![]() ![]() ![]() ![]() |
If you only want to save customized controls you have to call the .CreateOriginalControls on the CommandbarsControls collection after initially setting the controls on the commandbar. That way the CodeJock software knows when controls are customized.
|
|
Product: Xtreme SuitePro (ActiveX) version 15.3.1
Platform: Windows XP (32bit) - SP 3 (on VMWare) Language: Visual Basic 6.0 |
|
![]() |
|
dbenito ![]() Groupie ![]() Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() |
Thanks, but even after calling RibbonBar.Controls.CreateOriginalControls (where RibbonBar is a reference I store when calling CommandBars.AddRibbonBar), it still saves absolutely everything, which means I need to create the ribbon bar, load the user customization, and then reset all the captions, descriptions, etc. in case the user has changed the UI language of my program.
Moreover, calling RibbonBar.Reset does absolutely nothing. Back when we still used normal command bars, simply calling EnableCustomization was enough to get everything to work automatically. Do I now need to add code to the CustomizationResetAll event to re-create the ribbon? (This is what is done in the RibbonSample example.) I'm sorry, but this all seems like a step backwards - there are very basic things that should work automatically, and I find myself jumping through hoops just to get them working acceptably. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows 8.1 (64bit) Language: Visual Basic 6.0 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |