Print Page | Close Window

HOWTO: Increase number of used colors in TabCtrl

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=23602
Printed Date: 28 March 2024 at 10:19pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: Increase number of used colors in TabCtrl
Posted By: mgampi
Subject: HOWTO: Increase number of used colors in TabCtrl
Date Posted: 08 March 2018 at 10:10am
Hi;

How can I increase the number of colors used in colored tab controls when using OneNoteColors?
Now the color is repeated after 8 tabs (see screenshot).


If this is not possible with OneNoteColors, how can I get colored tabs in another way?

TIA


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Replies:
Posted By: olebed
Date Posted: 14 March 2018 at 7:48am
Hello Martin,

These colors defined in static method CXTPTabPaintManager::GetOneNoteColor(XTPTabOneNoteColor). You can increase number of colors  by adding new constants in enum XTPTabOneNoteColor.
enum XTPTabOneNoteColor
{
    xtpTabColorBlue    = 0x1000000, // Blue tab color used when OneNote colors enabled.
    xtpTabColorYellow  = 0x1000001, // Yellow tab color used when OneNote colors enabled.
    xtpTabColorGreen   = 0x1000002, // Green tab color used when OneNote colors enabled.
    xtpTabColorRed     = 0x1000003, // Red tab color used when OneNote colors enabled.
    xtpTabColorPurple  = 0x1000004, // Purple tab color used when OneNote colors enabled.
    xtpTabColorCyan    = 0x1000005, // Cyan tab color used when OneNote colors enabled.
    xtpTabColorOrange  = 0x1000006, // Orange tab color used when OneNote colors enabled.

    xtpTabColorNew    = 0x1000007, // Orange tab color used when OneNote colors enabled.

    xtpTabColorMagenta = 0x1000008  // Magenta tab color used when OneNote colors enabled.
};

Leave color xtpTabColorMagenta as last  to prevent changes in CXTPTabClientWnd::CWorkspace::GetItemColor() and CXTPTabManager::GetItemColor()

As other way you can change these two methods to return custom colors.

Also as the easyest way  you can set custom color right to CXTPTabManagerItem::m_clrItem. (CXTPTabManagerItem::SetColor(COLORREF)) If that value will be from 0x1000000 to 0x1000007  then it means predefined colors from xtpTabColorBlue to xtpTabColorMagenta. Other values will be used directly as colors.
See Samples\ToolkitPro\MDITabWindow\ChildWnd.cpp  CChildWnd::OnGetTabColor()

Regards,
 Oleksandr Lebed



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