![]() |
CXTPTabClientWnd tab change icon |
Post Reply
|
| Author | |
ruanjiandev
Newbie
Joined: 16 June 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTPTabClientWnd tab change iconPosted: 16 June 2005 at 8:18pm |
|
CXTPTabClientWnd tab dose not change the icon automatically when I change the icon of the MDIFrame by call SetIcon(...) Any one know the workaround? thanks |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 June 2005 at 3:50am |
|
TabClient send WM_XTP_GETTABICON first to get current icon: BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) void CChildFrame::OnBack() LRESULT CChildFrame::OnGetTabIcon(WPARAM, LPARAM) |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
danpetitt
Senior Member
Joined: 17 July 2005 Location: United Kingdom Status: Offline Points: 109 |
Post Options
Thanks(0)
Quote Reply
Posted: 30 July 2006 at 6:26pm |
|
I am using this method and an overridden CXTTabClientWnd::GetTabIcon to draw an 'occasional' icon on my client tabs.
However the tabs that dont get an icon still has the caption text moved to the right the width of an icon even when there isnt one.
Is there any chance that the space is only allocated if the GetTabIcon returns TRUE?
Or perhaps there is a nice way of doing this?
It would also be nice to specify the size of the icon used (i dont want 16x16) and also the location "Left/Right".
|
|
![]() |
|
danpetitt
Senior Member
Joined: 17 July 2005 Location: United Kingdom Status: Offline Points: 109 |
Post Options
Thanks(0)
Quote Reply
Posted: 31 July 2006 at 4:00am |
|
I got this working in the end. I had to derive a class from CSingleWorkspace and override the DrawIcon function so I could pass back/modify the icon size where and if appropriate.
For those that would like this, here is the code:
|
|
![]() |
|
mailhaim
Newbie
Joined: 28 September 2005 Status: Offline Points: 26 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2006 at 4:15am |
|
Hi Oleg,
I'm not fully understand what is the purpose of: ON_COMMAND(ID_BACK, OnBack) in order to fetch the tab icon and where ID_BACK defined?! I took the OnBack and put it in OnGetTabIcon, as follows: LRESULT CChildFrame::OnGetTabIcon(WPARAM, LPARAM) { HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); if( hIcon != NULL ) { SetIcon(hIcon, FALSE); GetParentFrame()->RecalcLayout(); return 0; } return ::SendMessage(m_hWnd, WM_GETICON, ICON_SMALL, 0); } The problem is this code is constantly get called. What is the problem? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2006 at 7:55am |
|
If you don;'t need dynamically change it you can create icon in constructor: CChildFrame::CChildFrame()
{ m_hIconTab = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } and retrieve it:
LRESULT CChildFrame::OnGetTabIcon(WPARAM, LPARAM)
{ return (LRESULT)m_hIconTab; } |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
mailhaim
Newbie
Joined: 28 September 2005 Status: Offline Points: 26 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 November 2006 at 3:01am |
|
Hi oleg,
The icon I would like to use depnds on information that persist in the document. What is the first place that the frame and document are attached? I tried in OnCreateClient() but GetActiveDocument() returns NULL. Regards, Haim |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 November 2006 at 6:08am |
|
Hi,
think best place is OnInitialUpdate.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |