Icons on CXTPDockingPane(s) when displayed as tabs |
Post Reply |
Author | |
wssdev
Groupie Joined: 04 May 2010 Status: Offline Points: 19 |
Post Options
Thanks(0)
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); ... 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! ▲ |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
wssdev
Groupie Joined: 04 May 2010 Status: Offline Points: 19 |
Post Options
Thanks(0)
|
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? ▼ ▲ |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
You can call SetIcons for each Id you need. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
wssdev
Groupie Joined: 04 May 2010 Status: Offline Points: 19 |
Post Options
Thanks(0)
|
Fair enough. Thanks. ▼ ▲ |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |