![]() |
Switching Themes on a CXTPTabClientWnd |
Post Reply
|
| Author | |
Jayonas
Newbie
Joined: 28 September 2007 Location: United States Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Topic: Switching Themes on a CXTPTabClientWndPosted: 17 October 2007 at 3:03pm |
|
I'm working on making a UI that is best described as Visual Studio with a ribbon. I just put in the workspace area, using CXTPTabClientWnd, and was absolutely gleeful that it just picked up the theme that my ribbon was already using and rendered itself appropriately. That is awesome.
I have one minor problem: when I change themes the CXTPTabClientWnd only partially updates itself. The current tab changes to reflect the new theme, but the background behind the tabs and the tabs which aren't selected retain the old theme. Tabs that aren't selected actually use the new theme for their mouseover state, but go back to the old theme after the mouse leaves. Here's a screenshot:
I started with the black theme and then switched to silver. Resource 1 is the current tab and correctly using the new theme. Resource 0 is not the current tab and is incorrectly using the old theme. Resource 2 has the mouse over it and only uses the new theme while in that state. As soon as the mouse leaves it, it will go back to looking like Resource 0. It's not shown in the picture, but the area of the tab control that has no tabs (including the Close and Arrow buttons) is also still using the old theme. Here's the code I'm using to change themes:
I would normally guess that there's method of CXTPTabClientWnd that I should be calling to have it refresh itself. However, since it at least partially responds to the theme changing (the active tab does change correctly), I'm not so sure that I'm forgetting something. In theory, I'd guess that passing RDW_ALLCHILDREN to RedrawWindow would cause any refreshing necessary (since the CXTPTabClientWnd instance is a child of the class that contains that code, which is the CXTPMDIFrameWnd). Any ideas? Thanks! |
|
![]() |
|
Jayonas
Newbie
Joined: 28 September 2007 Location: United States Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 October 2007 at 4:21pm |
|
Also, it turns out that I'm having the same problem with docking panes. When two panes are stacked (so they have tabs to switch between them) the tabs are having the exact same problem with not switching themes.
A related question: are the docking pane title bars and Pin/Close buttons supposed to match the ribbon theme? The best I could find to get it to do that was to set the pane manager use xtpPaneThemeOffice2007, but that doesn't seem to work. It would be really nice if the panes could paint their title bars and Pin/Close buttons using the ribbon's paint manager like the tab client window does. Thanks again! |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 October 2007 at 4:46am |
|
Hi,
try call Refresh method of TabClient.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Jayonas
Newbie
Joined: 28 September 2007 Location: United States Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 October 2007 at 3:32pm |
|
No luck, unfortunately.
I tried Refresh, RedrawWindow, and UpdateWindow, all to no avail. Another interesting thing to add to the mix.. I just added a few buttons that create new documents and docking panes arbitrarily. If I switch themes and then create more documents and/or docking panes, even those brand new items are using the old theme. I'd guess that doesn't matter much, since the DockingPaneManager is probably using the same drawing code whether or not its drawing a tab that was created before the switch or after. I figured it couldn't hurt to mention it anyway, though. Any other ideas? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 October 2007 at 12:40am |
|
Hi,
try this:
m_pClient->Refresh();
m_pClient->GetPaintManager()->RefreshMetrics(); |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Jayonas
Newbie
Joined: 28 September 2007 Location: United States Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 October 2007 at 10:32am |
|
Yay, that did it! It turns out that calling Refresh isn't even necessary, RefreshMetrics worked by itself. I made the same call on the DockingPaneManager and it fixed that too.
The docking pane headers and pin/close buttons still render with a different theme than everything else, but I suspect that's by design. It'd be great if they could make use of ribbon styles in a future version. :) Thanks a lot for your help! |
|
![]() |
|
shineryu
Groupie
Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
Post Options
Thanks(0)
Quote Reply
Posted: 02 December 2007 at 11:25pm |
|
Hi,
Try this:
m_pPaneManager->GetPaintManager()->RefreshMetrics();
|
|
![]() |
|
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 |