Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - How to change toolbar icon
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change toolbar icon

 Post Reply Post Reply
Author
Message
rdtcgriffin View Drop Down
Newbie
Newbie


Joined: 18 March 2004
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdtcgriffin Quote  Post ReplyReply Direct Link To This Post Topic: How to change toolbar icon
    Posted: 20 April 2004 at 11:18pm

I need to change an icon in the toolbar whenever a Flag within the program is changed. How do I do this?

Thanks

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 21 April 2004 at 6:28am
Change the IconId.  For example, say you have set the "Tag" value of your image in an image list to 100, 101, and 102.  The you would have the following code:

'Declare constants
Const ID_FILE_SAVE = 100
Const ID_FILE_SAVED = 101
Const ID_FILE_NEW = 102

'Add a toolbar and a control to the toolbar
Dim Control As CommandBarControl
Dim ToolBar As CommandBar
Set ToolBar = CommandBars.Add("Standard", xtpBarTop)
    With ToolBar.Controls   
        Set Control = .Add(xtpControlButton, ID_FILE_SAVE, "Save", -1, False)
     End With

'Find the control in the toolbar and change the IconId
Set Control = CommandBar.FindControl(, ID_FILE_SAVE,,True)
If Not Control Is Nothing Then
    Control.IconId = IF_FILE_SAVED
EndIf




Edited by SuperMario
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.188 seconds.