Print Page | Close Window

[SOLVED!] Change System Button at runtime?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=15922
Printed Date: 16 May 2024 at 9:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED!] Change System Button at runtime?
Posted By: shipwreck
Subject: [SOLVED!] Change System Button at runtime?
Date Posted: 25 December 2009 at 11:00pm
Hello Folks; here's a quick question for you:
 
I know that you can change the ribbon theme in runtime, but can you change the system button style at runtime also?
You know, like change it from the "Orb" to the rectangular blue item.
Also, how could you do this from another sub other than commandbars_execute?


-------------
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6



Replies:
Posted By: cmm2006
Date Posted: 26 December 2009 at 7:34am
hi,
you can use CommandBars_Update to do so
good luck


-------------
Language: Visual Basic 6 SP6
OS: Windows XP Pro SP3
Product: Codejock Xtreme SuitePro 13.1


Posted By: shipwreck
Date Posted: 26 December 2009 at 7:37am
I assumed that but how would I call it? I normal use the "CommandBars.findcontrol (type, ID) but that just doesn't seem to work with the Ribbon system button.

-------------
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6


Posted By: jpbro
Date Posted: 27 December 2009 at 1:37pm
There are a couple of ways that you can do this. The easiest is:


   Me.CommandBars1.Item(1).ControlSystemButton.Style =   xtpButtonAutomatic  ' Switch to "Orb" style

   Me.CommandBars1.Item(1).ControlSystemButton.Style = xtpButtonCaption      ' Switch to caption style


As it seems that the Ribbon is Item #1 in the commandbars control collection. However, I don't think that this is the safest way, as you can't guarantee that CJ will always maintain the Ribbon in that position.

IMHO, a better option would be to store a reference to the Ribbon control in a module level variable when you create it, such as:

In the General Declarations section:


Private mo_Ribbon As XtremeCommandBars.RibbonBar



In the sub where you add the ribbon bar:

      Set mo_Ribbon = .AddRibbonBar("MyRibbon")


And then when you want to change the ribbon style:

   mo_Rbn.ControlSystemButton.Style = xtpButtonAutomatic   ' Switch to "Orb" style

   mo_Rbn.ControlSystemButton.Style = xtpButtonCaption      ' Switch to caption style



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: shipwreck
Date Posted: 27 December 2009 at 9:12pm
Hey man long time no talk!
But I greatly appreciate the response.
I'll try these options right now & let you know if it works.


-------------
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6


Posted By: shipwreck
Date Posted: 27 December 2009 at 11:10pm
Okay. Since you said there was no guarantee for the first option I went ahead and tried the second one.
And guess what? It works great! It's nice to get some real support around here ever once and a while.
Well, I'm off to try that other option for combined command buttons.
 
Thanks jpbro, I really appreciate it!


-------------
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net