| Author |
Topic  |
|
|
Matthew N Page
4 Posts |
Posted - 03/09/2001 : 12:40:02 PM
|
In my application, I've created 2 32x32 toolbar resources. One is hot, the other cold. Adding these to my main toolbar using LoadToolBar works fine. I then call CBCGToolBar::AddToolBarForImageCollection (IDR_MENUIMAGES) to add the other menu resources. Here is my problem, in Customize|Commands dragging a command (one of the AddToolBarForImageCollection images) to the toolbar adds an invisible item. The text shows up but not the image. When you mouse-over the button the image shows up. If you drag one the toolbar images that has both hot and cold images defined, it shows fine. Any help would be appreciated.
Thanks, Matt
|
|
|
Support
2572 Posts |
Posted - 03/09/2001 : 2:05:25 PM
|
All images placed on the customizable (non-"locked") toolbars should br with the same size. If you need the images larger than the "standard" (16x15 or 16x16) size, you need to create an addition copy for each toolbar image with the small size (16x15). and pass it into toolbar's LoadBitmap. This image will be displayed on the menu items:
m_wndToolBar.LoadToolBar (IDR_TOOLBAR, // 32x32 toolbar resource, 16 colors, "hot" IDB_COLD, // 32x32 bitmap, 16 or 256 colors, "cold" IDB_MENU, // 16x16 bitmap, 16 or 256 colors, "hot" FALSE, // Not "locked" 0, 0 // Disabled images, optional IDB_HOT); // 32x32 bitmap, required for 256 color bitmap
CBCGToolBar::AddToolBarForImageCollection (IDR_MENUIMAGES); // 16x16 menu images
Best regards,
Technical Support BCGSoft Ltd. |
 |
|
|
Matthew N Page
4 Posts |
Posted - 03/09/2001 : 4:59:06 PM
|
I copied your code and pasted it into my program. I changed the bitmaps to toolbars (does it matter???) to match my code, it looked like this:
m_wndToolBar.SetMenuSizes(CSize(22,22), CSize(16,16)); if (!m_wndToolBar.CreateEx(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME_HOT, //32x32 toolbar resource 16 colors HOT IDR_MAINFRAME, //32x32 toolbar resource, 16 colors, "cold" IDR_MAINFRAME_HOT_SM,//16x16 toolbar resource, 16 colors, "hot" FALSE, //Not Locked 0, 0,// Disabled images, optional IDR_MAINFRAME_HOT// 32x32 toolbar resource, 16 colors )) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CBCGToolBar::AddToolBarForImageCollection (IDR_MENUIMAGES_SM);//16x16 toolbar, 16 colors
Notice that I had to call SetMenuSizes beforehand. Without it, I get an assertion. The above code doesn't work. The mainframe toolbar (cold) is jumbled (images look off). The IDR_MENUIMAGES_SM images don't show up at all. The IDR_MAINFRAME_HOT_SM show up correctly. I verified all of the toolbar resources are 0-31X by 0-31Y and 0-15X by 0-15Y respectively. Any ideas?
Matt
P.S. If I change the AddToolBarForImageCollection (IDR_MENUIMAGES_SM) toolbar resource from 16x16 to 32x32, the main toolbar looks correct (32x32) and the main toolbars menu images (16x16) look correct. But the IDR_MENUIMAGES added to the image collection don't show up, furthermore Customize|Commands dragged to the main toolbar still don't show up unless hovered over.
quote:
All images placed on the customizable (non-"locked") toolbars should br with the same size. If you need the images larger than the "standard" (16x15 or 16x16) size, you need to create an addition copy for each toolbar image with the small size (16x15). and pass it into toolbar's LoadBitmap. This image will be displayed on the menu items:
m_wndToolBar.LoadToolBar (IDR_TOOLBAR, // 32x32 toolbar resource, 16 colors, "hot" IDB_COLD, // 32x32 bitmap, 16 or 256 colors, "cold" IDB_MENU, // 16x16 bitmap, 16 or 256 colors, "hot" FALSE, // Not "locked" 0, 0 // Disabled images, optional IDB_HOT); // 32x32 bitmap, required for 256 color bitmap
CBCGToolBar::AddToolBarForImageCollection (IDR_MENUIMAGES); // 16x16 menu images
Best regards,
Technical Support BCGSoft Ltd.
Edited by - Matthew N Page on 03/09/2001 17:03:52 |
 |
|
|
Support
2572 Posts |
Posted - 03/15/2001 : 5:13:09 PM
|
To solve this problem, instead of call CBCGToolBar::AddToolBarForImageCollection, just create a temporary toolbar by the following way:
{ CBCGToolBar tlbTmp; tlbTmp.LoadToolBar (IDR_IMAGES, // Toolbar with 32x32 menu images, 16 colors IDB_COLDIMAGES, // Bitmap with 32x32 images, 256 colors, "cold" IDB_MENUIMAGES, // Bitmap with 16x16 images, 256 colors FALSE, // Non-locked 0, 0, // Disabled images,optional IDB_HOTIMAGES); // Bitmap with 32x32 images, 256 colors, "hot" }
Library loads these images into the global collections and commands from the toolbar 'IDR_IMAGES' will be associated with images as well.
In the next version (5.3), we'll add some additional parameters to CBCGToolBar::AddToolBarForImageCollection and problem will be solved.
Best regards,
Technical Support BCGSoft Ltd. |
 |
|
| |
Topic  |
|
|
|