Toolbar button icons not shown |
Post Reply |
Author | |
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Show code where you add buttons to toolbar.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |