Print Page | Close Window

ImageManager

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=8108
Printed Date: 13 November 2025 at 2:30pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ImageManager
Posted By: Haris
Subject: ImageManager
Date Posted: 20 September 2007 at 7:54pm
Hi, I am working on an issue with icons being replaced by their tooltip text when using Image Manager.
 
My code looks like:
CXTPImageManager* pImageManager;
if (curIcon != NULL)
{
   //pActionControl->SetCustomIcon(curIcon);
   CSize cSize(BUTTONSIZE,BUTTONSIZE);
   pImageManager = GetImageManager();
   BOOL bSuccess = pImageManager->SetIcon(curIcon,  cmdId, cSize);
   DestroyIcon(curIcon);
}
 
-pActionControl is of type CXTPControl*
 
If I open multiple charts and they both use this control then after closing one of the charts, the icons for 2nd chart are replaced by their tooltip text and the icon disappears.
 
After investigating this further, it appears SetIcon only adds the image to the image manager once and when I hit the OnDestroy of my class it is cleaned up. Therefore, the icons disappear from the 2nd chart.
 
I have tried creating a seperate ImageManager object for each class in the constructor that uses GetImageManager but that didn't help:
CXTPImageManager* pImageManager = new CXTPImageManager();
SetImageManager(pImageManager);
 
Please note that this does not happen if I use SetCustomIcon instead of using Image Manager and SetIcon. Also, code above for Image Manager and SetIcon seems to work with CXTPControlButton.
 
Following works fine:
CXTPImageManager* pImageManager;
if (hCurIcon != NULL)
{
    //nextButton->SetCustomIcon(hCurIcon);
    pImageManager = GetImageManager();
    BOOL bSuccess = pImageManager->SetIcon(hCurIcon, IDM_NEXT_PATIENT, cSize);
    DestroyIcon(hCurIcon);
}
 
- nextButton is of type CXTPControlButton
 
Can Image Manager be used with anything other than CXTPControlButton? Am I doing something wrong here?
 
I am new to codejock so any help you can provide will be much appreciated!
 
Thanks,
Haris
 



Replies:
Posted By: Oleg
Date Posted: 21 September 2007 at 12:42am
Hello,
 
Yes, by default all CommandBars use same ImageManager
you can
1. Create separate ImageManager fro each CommandBars:
 
GetCommandBars()->SetImageManager(new CXTPImageManager()));
 
2. or try not repeat Ids for buttons. Check your resource.h files and manually edit it to remove all dublicate resources.


-------------
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