Making dockingpane color match ribbon color |
Post Reply |
Author | |||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
Posted: 18 June 2008 at 8:24pm |
||
Hello. I have an application that uses the ribbon, and also has docking panes. I'm giving users the option of changing the color scheme of the ribbon (blue, black, silver, aqua). However, I can not figure out how to change the docking pane color scheme to match.
I've tried the following code, but it doesn't work. What am I missing? HMODULE hModule = AfxGetInstanceHandle(); LPCTSTR lpszIniFile = _T("OFFICE2007BLACK.INI"); break; XTPOffice2007Images()->SetHandle(hModule, lpszIniFile); m_paneManager.GetPaintManager()->RefreshMetrics(); m_paneManager.RedrawPanes(); Thanks. |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
BTW, I have already set the docking pane theme to xtpPaneThemeOffice2007. But the docking panes always have the blue color scheme, no matter what color scheme I chose for the ribbon.
|
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi,
Do you have 12.0 release ?
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
No, I'm using 11.1.3. Are you saying that this has been fixed in 12.0?
|
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi,
Yes, think so.
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
Ok, I will download v12. But what code do I have to use in order to make the docking panes change color? Is it the code I posted above or something else? Does it happen automatically?
|
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi,
Yes, think this code will work for 12.0. You can download eval version to check.
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
I downloaded v12 and recompiled my project with it, but it still doesn't work. Is there a particular function I need to call?
|
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
I've debugged into the CXTPDockingPaneOffice2007Theme::RefreshMetrics() function, and can see that the clrNormalCaption and clrActiveCaption values being returned from XTPOffice2007Images()->GetImageColor() are always the blue colors.
So it would appear that the XTPOffice2007Images()->SetHandle() function is not setting the images correctly... |
|||
Smucker
Senior Member Joined: 02 February 2008 Status: Offline Points: 156 |
Post Options
Thanks(0)
|
||
I have a method called "SetAllTheme" to try to keep various pieces in sync, and it is working for me in 12.0. As far as I remember, it worked in 11.2 as well.
void CMainFrame::SetAllTheme(XTPPaintTheme theme, PCTSTR ini_file) { XTPDockingPanePaintTheme panetheme = xtpPaneThemeDefault; XTPPropertyGridPaintTheme gridtheme = xtpGridThemeDefault; CXTPCommandBars* pbars = GetCommandBars(); pbars->SetTheme(theme); XTPPaintManager()->SetTheme(theme); switch (theme) { case xtpThemeOfficeXP: case xtpThemeOffice2000: panetheme = xtpPaneThemeOffice; gridtheme = xtpGridThemeOfficeXP; break; case xtpThemeOffice2003: panetheme = xtpPaneThemeOffice2003; gridtheme = xtpGridThemeOffice2003; break; case xtpThemeNativeWinXP: panetheme = xtpPaneThemeNativeWinXP; gridtheme = xtpGridThemeNativeWinXP; break; case xtpThemeOffice2007: panetheme = xtpPaneThemeOffice2007; gridtheme = xtpGridThemeOffice2007; break; case xtpThemeRibbon: panetheme = xtpPaneThemeOffice2007; gridtheme = xtpGridThemeOffice2007; break; default: panetheme = xtpPaneThemeDefault; gridtheme = xtpGridThemeDefault; break; } m_paneManager.SetTheme(panetheme); m_wndProp.SetTheme(gridtheme); if ( (theme == xtpThemeOffice2007 || theme == xtpThemeRibbon) && ini_file) { ((CXTPOffice2007Theme*)pbars->GetPaintManager()) ->SetImageHandle(AfxGetInstanceHandle(), ini_file); ((CXTPOffice2007Theme*)XTPPaintManager()) ->SetImageHandle(AfxGetInstanceHandle(), ini_file); } m_paneManager.UpdatePanes(); m_paneManager.GetPaintManager()->GetPanelPaintManager() ->SetLayout(xtpTabLayoutAutoSize); m_paneManager.GetPaintManager()->RefreshMetrics(); m_paneManager.RedrawPanes(); XTPPaintManager()->RefreshMetrics(); pbars->GetImageManager()->RefreshAll(); pbars->RedrawCommandBars(); theApp.m_panetheme = panetheme; theApp.m_gridtheme = gridtheme; theApp.m_painttheme = theme; _tcscpy_s(theApp.theme_ini, TSIZE(theApp.theme_ini), ini_file ? ini_file : _T("")); SaveAppPreferences(); } Then I set the black theme using: SetAllTheme(xtpThemeOffice2007, _T("OFFICE2007BLACK.INI")) Some of the things I'm doing probably aren't necessary, but I haven't worked on paring it down yet. If you're linking statically like I do, be sure that you include the necessary resources in your .rc2 file: #include <XTToolkitPro.rc> #include "Styles\Office2007Blue\Office2007Blue.rc" #include "Styles\Office2007Aqua\Office2007Aqua.rc" #include "Styles\Office2007Black\Office2007Black.rc" #include "Styles\Office2007Silver\Office2007Silver.rc" #include "SkinFramework\Styles\Office2007\Office2007.rc" |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
Thanks for posting the code Smucker. Unfortunately, it does not work for me. The docking pane colors are still not changing. But one thing you said interests me. You said you are using static linking; I am just using a dll.
Oleg - have you heard of any problems with changing the docking pane colors when Codejock is compiled as dlls? |
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi, Check that you use Office2007Black from last release. Maybe you copied it from 11.1.3 and still use it.
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
How can I check to make sure I'm using the right one? The ribbon color changes correctly, so I would assume the Office2007black is correct.
|
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi, Copy it from Source\Styles folder.
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
Yes, I am using the correct Office2007black.
|
|||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||
Hi,
Please modify our Pane sample or any from DockingPane folder and attach it here. It have to work.
|
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
Hi. I modified the Pane sample, and I was able to make the panes change colors. I also was able to do the same thing in 11.1.3.
All I added was this: void CMainFrame::OnThemeOffice2007black() { AdjustStyle(xtpPaneThemeOffice); SetDockingPaneTheme(xtpPaneThemeOffice2007); m_nSelectedTheme = ID_THEME_OFFICE2007BLACK; HMODULE hModule = AfxGetInstanceHandle(); LPCTSTR lpszIniFile = _T("OFFICE2007BLACK.INI"); XTPOffice2007Images()->SetHandle(hModule, lpszIniFile); m_paneManager.GetPaintManager()->RefreshMetrics(); } Unfortunately, this does not work in my project. If I am doing this part correctly, what else might be the problem? Any general ideas of where I might look within my project? Pane creation, maybe? |
|||
Smucker
Senior Member Joined: 02 February 2008 Status: Offline Points: 156 |
Post Options
Thanks(0)
|
||
HMODULE hModule = AfxGetInstanceHandle();
This gets the HINSTANCE to your EXE (or your user DLL). Don't you need the HINSTANCE for the Codejock DLL? LPCTSTR lpszIniFile = _T("OFFICE2007BLACK.INI"); XTPOffice2007Images()->SetHandle(hModule, lpszIniFile); So I think this is trying to find OFFICE2007BLACK.INI in your EXE or DLL rather than the Codejock DLL. Run in the debugger and setup into SetHandle and make sure that FindResource finds it (XTPOffice2007Image.h line 725 in 12.0.0) I could be wrong. I often am, and I prefer using/distributing as few DLLs as possible. |
|||
tommylov
Groupie Joined: 09 January 2007 Location: United States Status: Offline Points: 20 |
Post Options
Thanks(0)
|
||
Thanks for chiming in again, Smucker. I appreciate you trying to help.
I debugged through the code, and it is picking up the the proper office2007black.ini file. In fact, when I debugged through XTPOffice2007Images()->SetHandle, I saw that the black profile was retrieved successfully. But then when I debugged through m_paneManager.GetPaintManager()->RefreshMetrics(), which is the very next line in my code, the profile had been changed back to blue. |
|||
Smucker
Senior Member Joined: 02 February 2008 Status: Offline Points: 156 |
Post Options
Thanks(0)
|
||
Here's something I did a little differently (cribbed from a CJ sample, I'm sure); maybe it has something to do with something!
I also call
before
Another thing to try in the debugger would be to set a data breakpoint on a memory location (such as a color value) that you know is changing between your two lines of code, so you can see what is mucking with it. Good luck! I know it can work. Here's an example of Office 2007 style black panes with an Office 2007 style command bar::
Full size image |
|||
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 |