Can't get image to show for dynamically added buttons

Add-in Express™ Support Service
That's what is more important than anything else

Can't get image to show for dynamically added buttons
 
Ryan Farley




Posts: 109
Joined: 2005-04-28
In my addin I am creating ADXCommandBarButtons at runtime. I have an image list that I use to assign the images to these buttons. The buttons are being added just fine, but I can't get the images to show for the buttons. I can see the place for the image along side the caption, and I have verified that I am setting the Style property to adxMsoButtonIconAndCaption (again, I can see the place for the image, just no image).

The images show fine for buttons added at design time, just not the ones added at runtime.

Any suggestions?

Thanks,
-Ryan
Posted 14 Oct, 2006 12:38:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7229
Joined: 2004-07-05
Hi Ryan.

Do you set the Style property before you apply images to the ADX buttons?
Posted 16 Oct, 2006 08:26:08 Top
Sergey Grischenko


Add-in Express team


Posts: 7229
Joined: 2004-07-05
Ryan, actually the code should work properly regardless the fact when you change the Style property.
Did you set the Images property of the addinmodule or the ImageList property of the ADXCommandBarButton component?
Posted 16 Oct, 2006 08:40:22 Top
Ryan Farley




Posts: 109
Joined: 2005-04-28
Sergey Grischenko wrote:
Did you set the Images property of the addinmodule or the ImageList property of the ADXCommandBarButton component


I am setting the images from an imagelist, not from the Images property of the addinmodule.

Does that make a difference?
Posted 16 Oct, 2006 13:41:28 Top
Ryan Farley




Posts: 109
Joined: 2005-04-28
Well I guess it does. As soon as I changed to use the Images property of the addinmodule (instead of a separate ImageList) it is working now.

I can live with that, but should it work using a separate imagelist? It would simplify my code as my addin has static button and also dynamic ones loaded from definitions in a database. The images for the dynamic buttons are also loaded from the database, so it would make thing simpler to have those in a sepaate imagelist. If not, I can live with loading all the images using the IMages property of the addinmodule.

Thanks.
Posted 16 Oct, 2006 13:50:38 Top
Sergey Grischenko


Add-in Express team


Posts: 7229
Joined: 2004-07-05
Ryan, to set a separate ImageList for a button you can use the ImageList property of the ADXCommandBarButton component.

Posted 17 Oct, 2006 05:45:44 Top
Ryan Farley




Posts: 109
Joined: 2005-04-28
That's what I thought, and was what I was doing originally, although I could not get my images to show for the ADXCommandBarButtons created at runtime. However, it did work fine once I switched to using the Images property of the AddinModule.

Anyway, thanks for the help. I can live with using the Images property of AddinModule and that is working fine.

Thanks.
Posted 17 Oct, 2006 11:10:31 Top
Sergey Grischenko


Add-in Express team


Posts: 7229
Joined: 2004-07-05
Ryan, you just needed to set the ImageList property first.
Posted 17 Oct, 2006 11:23:04 Top
Ryan Farley




Posts: 109
Joined: 2005-04-28
Doh! Thanks Sergey!
Posted 17 Oct, 2006 12:16:04 Top