MDI tab colors on per tab basis
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=23205
Printed Date: 23 December 2024 at 3:23pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: MDI tab colors on per tab basis
Posted By: rdhd
Subject: MDI tab colors on per tab basis
Date Posted: 17 November 2016 at 5:50pm
I would like to user differing background colors for tabs. So far it looks like it is an all or nothing scenario. What I would like to do is let the user open a document and then color the background of the tab item for the document with a special color if the document is read-only. So for instance we currently have a dark blue tab color for the selected tab and white for unselected tabs. But if the user selects a document that is read-only, I want to change the color of the selected tab.
Ideally this would be a color I could set in the tab item but I didn't see that. I do implement WM_XTP_PRETRANSLATEMOUSEMSG so I can trap mouse clicks. So I could trap the user activating a tab via the mouse. I also have code that draws the navigation button and it calls GetColorSet.
I could live with only coloring the active tab differently when the file is read-only. Hence I could detect when the MDI tab is activated and then change a color. I found CXTPTabClientWnd::OnMDIActivate/MDIActivate methods. I already subclass CXTPTabClientWnd so I can implement a handler for the former or override the latter since when I click a tab item, they are called. But not when I control-tab, control-shift-tab. However I can probably work that out as I have MDI message handling in my frame.
So I think the only thing I haven't figured out yet is how to get the color being used to draw the selected item so I can change it when the newly selected item for a read-only document.
Does anyone know how I can access that color and change it?
|
Replies:
Posted By: rdhd
Date Posted: 17 November 2016 at 6:10pm
Ok. So I found the color set and GetItemColor uses m_clrButtonSelected. I can change that value's custom color, which is being used in my case, to a different value and I see the selected tab (and the lower border of the tab client) drawn with that color. So now I just need to figure out how to change m_clrButtonSelected. GetItemColor is virtual but it looks like I have to handle each tab color set that can be created as the user changes command bar themes.
I see no method that lets me set m_clrButtonSelected. It is public so I could just directly change the color but that's not robust (what if it goes private).
Any suggestions on an alternative way to do this would be appreciated. Especially if it is something simple that I am missing.
|
|