Print Page | Close Window

How to change toolbar icon

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=643
Printed Date: 11 December 2024 at 9:14pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to change toolbar icon
Posted By: rdtcgriffin
Subject: How to change toolbar icon
Date 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




Replies:
Posted By: SuperMario
Date 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





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