Icons on CXTPDockingPane(s) when displayed as tabs
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=16874
Printed Date: 25 February 2025 at 5:01pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Icons on CXTPDockingPane(s) when displayed as tabs
Posted By: wssdev
Subject: Icons on CXTPDockingPane(s) when displayed as tabs
Date Posted: 24 June 2010 at 9:05am
XTP 10.31
What seemed like a trivial task turned into a nightmare: I'm trying to
set an icon (a single icon) to all docking panes (CXTPDockingPanes),
without any success. When panes are arranged as tabs inside a
CXTPDockingPaneTabbedContainer, the icon I've set for each pane (the
same one) is not displayed on any tabs.
If it matters, docking panes are created dynamically and their number is
not known in advance.
Here are a few of my attempts:
1) Image is stored as a bitmap resource IDR_MY_BITMAP
CImageList myImageList;
BOOL created = myImageList.Create(IDR_MY_BITMAP, 16, 1, RGB(255, 255,
255)); // Loads just fine
XTPImageManager()->SetImageList(myImageList.Detach(), IDR_MY_BITMAP,
TRUE);Snippet // OK, image list gets stored
internally
... later in the code
CXTPImageManagerIcon* pIcon =
XTPImageManager()->GetImage(IDR_MY_BITMAP); // works fine, image
list is found and the ID matches
// iterate through all CXTPDockingPanes
// _paneManager is CXTPDockingPaneManager
_paneManager.SetIcon(<xtpPaneId>, pIcon->GetIcon()); //
GetIcon() has m_hIcon == NULL (?)
Turns out, this doesn't work because CXTPImageManagerIcon::GetIcon()
actually does not use the image list passed in the constructor
(myImageList). The image list is used only when CXTPImageManagerIcon is
asked to draw the icon (?).
2) Image stored as the icon resource IDR_MY_ICON
CXTPImageManagerIconHandle
iconHandle(AfxGetApp()->LoadIcon(IDR_MY_ICON)); // works fine,
internal HICON is valid
_paneManager.SetIcon(<xtpPaneId>, iconHandle); // no effect?
It must be trivial to associate an icon with a pane and have it
displayed when the pane is tabbed, and yet I'm missing something
obvious. What is it?
Thanks in advance!
|
Replies:
Posted By: Oleg
Date Posted: 25 June 2010 at 1:44am
Just follow samples. Don't use SetImageList/CXTPImageManagerIconHandle - if you not sure how they work
Here code from PaneSample:
int nIDs1[] = {IDR_PANE1, IDR_PANE2, IDR_PANE3, IDR_PANE4, IDR_PANE5};
m_paneManager.SetIcons(IDB_BITMAP1, nIDs1, 5, RGB(0, 255, 0));
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: wssdev
Date Posted: 25 June 2010 at 4:20am
Thanks for your answer.
Unfortunately, that was the very first thing I tried.
SetIcons() seems to require that the bitmap resource has exactly the same number of images as there are pane IDs passed to it.
I have a dynamic number of panes.
Besides, SetIcons internally calls SetIcon(<id>, <icon>), which is what I've been trying to do in the examples I posted.
Is there some other way to assign an image individually to a pane?
|
Posted By: Oleg
Date Posted: 28 June 2010 at 2:14am
Hi,
You can call SetIcons for each Id you need.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: wssdev
Date Posted: 28 June 2010 at 4:39am
|