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