Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Icons on CXTPDockingPane(s) when displayed as tabs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Icons on CXTPDockingPane(s) when displayed as tabs

 Post Reply Post Reply
Author
Message
wssdev View Drop Down
Groupie
Groupie


Joined: 04 May 2010
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote wssdev Quote  Post ReplyReply Direct Link To This Post Topic: Icons on CXTPDockingPane(s) when displayed as tabs
    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!


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
wssdev View Drop Down
Groupie
Groupie


Joined: 04 May 2010
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote wssdev Quote  Post ReplyReply Direct Link To This Post 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?




Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2010 at 2:14am
Hi,
You can call SetIcons for each Id you need.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
wssdev View Drop Down
Groupie
Groupie


Joined: 04 May 2010
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote wssdev Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2010 at 4:39am

Fair enough. Thanks.


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.