Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - [SOLVED!] Change System Button at runtime?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED!] Change System Button at runtime?

 Post Reply Post Reply
Author
Message
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED!] Change System Button at runtime?
    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
Back to Top
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.