Print Page | Close Window

Toolbar button icons not shown

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=9693
Printed Date: 25 June 2024 at 3:01am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Toolbar button icons not shown
Posted By: Aaron
Subject: Toolbar button icons not shown
Date Posted: 25 February 2008 at 9:00am
Hi,
 
I have a usercontrol (which will be loaded several times during runtime) and in each of these usercontrols I have a commandbar which will have a toolbar with 10 buttons (with icon).
 
The problem is this: The icons don't show on the buttons
 
Loading the icons with function:
 
CommandBars.Icons.LoadBitmap App.Path & "\toolsviews.bmp", Array(301, 302, 303, 304, 305, 306, 307, 308, 309, 310), xtpImageNormal
(imageheight = 16)
 
This is what I checked:
The buttons are loaded correctly (mouseover displays selection area)
The Icon ID's match loaded icon id (CommandBars_Execute event)
The number of icons in Commandbars (Commandbars.Icons.Count = 10)
 
Any help would be appreciated. Thanks in advance
 
 
 
 
 
 
 
 
 



Replies:
Posted By: Oleg
Date Posted: 25 February 2008 at 2:18pm

Hi,

 
Show code where you add buttons to toolbar.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Aaron
Date Posted: 26 February 2008 at 5:57am
Oleg,
 
I created a test project and copied the existing code into the new project. You wouldn't believe it, but it works !!!
 
Now for my existing project. Loading the toolbar like this:
 
Private function LoodToolbarItems()
    CommandBarSubviews.Icons.RemoveAll
    CommandBarSubviews.Icons.LoadBitmap App.Path & "\Views\AreaBackground\toolsviews.bmp", Array(301, 302, 303, 304, 305, 306, 307, 308), xtpImageNormal
            
    Set toolBarSubViews = CommandBarSubviews.Add("Tools subview", xtpBarTop)
        
        AddButton toolBarSubViews.Controls, xtpControlButton, ID_TOOLBAR_LEFT, "", True, "Moves selected item to the left", xtpButtonIcon, "ToolSubView", True
''for every button AddButton.......
 
End Function
 
Private Function AddButton(Controls As CommandBarControls, ControlType As XtremeCommandBars.XTPControlType, Id As Long, Caption As String, Optional BeginGroup As Boolean = False, Optional DescriptionText As String = "", Optional ButtonStyle As XTPButtonStyle = xtpButtonAutomatic, Optional Category As String = "Controls", Optional ButtonClose As Boolean = True) As CommandBarControl
    Dim Control As CommandBarControl
    Set Control = Controls.Add(ControlType, Id, Caption)
   
    Control.BeginGroup = BeginGroup
    Control.DescriptionText = DescriptionText
    Control.Style = ButtonStyle
    Control.Category = Category
    Control.Enabled = True
    Control.CloseSubMenuOnClick = ButtonClose
   
    Set AddButton = Control
   
End Function
 

 
When everything is loaded I don't get images on the added buttons.
 
I added a testbutton with just 2 lines of code:
 
    CommandBarSubviews.Icons.RemoveAll
    CommandBarSubviews.Icons.LoadBitmap App.Path & "\Views\AreaBackground\toolsviews.bmp", Array(301, 302, 303, 304, 305, 306, 307, 308), xtpImageNormal
 
Now the icons will be shown!!!
 
But it's getting really weird now. I have a mainview (a form) with commandbar (Name = CommandbarView) and I use the same images for positioning (like the subviews (Name = CommandbarSubview)). When I load the images for CommandbarView (same ID's) ,the icons in CommandbarSubviews will be shown as well???
 
Are you following me, Oleg? Is it possible that Commandbars somehow connects with eachother? The only thing they have is a common Button.ID
 
I don't use Actions or anything else.
 
This is hairpuller of the third kind, I believe.


Posted By: Oleg
Date Posted: 26 February 2008 at 3:22pm
Actually by deafult All CommandBars share same ImageMaanger to save some resources. Think you delete icons in one of them so it deletes icons for all commandbars.
 
To use private icons for some commandbars call
 
CommandBars.Options.UseSharedImageList = False


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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