Print Page | Close Window

Multiple Skins for Multiple CommandBars

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=20320
Printed Date: 28 November 2024 at 12:14am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple Skins for Multiple CommandBars
Posted By: dang
Subject: Multiple Skins for Multiple CommandBars
Date Posted: 23 November 2012 at 8:39am
Hi

I have an application which uses XTP Themes throughout. I have recently added a modal dialog with several pages using Skin Framework, each page having a different skin. This works fine.

However, I am using a CXTPPopupBar on one of the pages for a pop-up menu, and this is not skinned correctly. On another page I am using a CMenu, and this skins correctly, but I cannot use CMenu for the other as I need features of CommandBars such as SetCloseSubMenuOnClick(false).

Reading these forums, it seems that to get CommandBars to be skinned, you need to do pPopupBar->SetPaintManager( new CXTPNativeXPTheme ) in a handler for WM_XTP_INITCOMMANDSPOPUP (i.e. after the hwnd is created). This works in that the popup is skinned, but it has the wrong skin.

Looking a little deeper, it seems that CXTPNativeXPTheme::RefreshMetrics gets looks up AfxGetMainWnd to get skinning info, rather than the window being skinned...

I tried deriving my own PaintManager from CXTPNativeXPTheme and overriding RefreshMetrics to use a specific window I know has the right skin applied to it. However, this does not work - it seems that in the hooked drawing functions for CommandBars the skin is looked up based on CXTPSkinManager::m_pSchema - the 'top level' schema named "NormalDefault_ini" - where I need it to look up the skin data from a specific child schema/ini.

I have tried calling CXTPSKinManager::LoadSkin("mySkins.cjstyles", "specificSkin.ini"), hoping to set the 'current' skin on the SkinManager, but of course this then affects the whole application behind the modal dialog.

Is there a way to have multiple CommandBars using multiple skins at the same time? It seems that it is designed with the assumption that only one skin at a time would ever be used with CommandBars. I hope this is not the case!

Any suggestions?

Thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net