Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Toolbar button icons not shown
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Toolbar button icons not shown

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

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Topic: Toolbar button icons not shown
    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
 
 
 
 
 
 
 
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2008 at 2:18pm

Hi,

 
Show code where you add buttons to toolbar.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
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.203 seconds.