Color Coded Tabs
Moderators: Hacker, petermad, Stefan2, white
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
TWinKey can not only colorize tabs, but assign an icon to each. And there is also another solution
Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
???
There is no Windows function to do this! Do I need to disable themes?
There is no Windows function to do this! Do I need to disable themes?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Hmm, do you happen to know the message? Couldn't find anything.Highlighting is done via tab control message
There is no owner drawing of tab headers. I would have to create my own tab control with owner drawing everything calling the theme commands myself.However I think tabs may be colored using custom erasing of background (i.e. we should be able to use any desired background color for tab header rectangles when Windows needs to redraw the control).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
In order to draw the tab headers do the following:
Create the tab using the TCS_OWNERDRAWFIXED style. Then draw in the normal WM_DRAWITEM handler in the parent window.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb760549%28v=vs.85%29.aspx
Actually there is but it doesn't cover the whole tab header area just the content area of the header. Just try and judge if this is enough for you. For me it seems TWinKey also uses only the content area for drawing.There is no owner drawing of tab headers.
In order to draw the tab headers do the following:
Create the tab using the TCS_OWNERDRAWFIXED style. Then draw in the normal WM_DRAWITEM handler in the parent window.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb760549%28v=vs.85%29.aspx
I got it from mentioned PowerPro script, the message is TCM_HIGHLIGHTITEM (but it doesn't allow specifying highlight color, it depends on Windows theme).ghisler(Author) wrote:Hmm, do you happen to know the message? Couldn't find anything.
But I still think that background erasing for entire tab control is still done using WM_ERASEBKGND, so overriding it should allow coloring tab headers as we like: you fill tab entire control with default background color but tab headers with another ones (there is a message TCM_GETITEMRECT that returns rectangles for tab headers).ghisler(Author) wrote:There is no owner drawing of tab headers. I would have to create my own tab control with owner drawing everything calling the theme commands myself.
It may reguire drawing entire tabs by hands.Lefteous wrote:Create the tab using the TCS_OWNERDRAWFIXED style. Then draw in the normal WM_DRAWITEM handler in the parent window.
2MVV
As discussed long ago there is also quite different approach to this feature. Using colored icons in tab headers. This would also work fine and doesn't even require custom drawing, a dirty hack or a custom control. It even works for all kind of visual styles.
Yes you have to draw the entire tab header client area. Or did you mean something else? I have tried it and that's the way it works. Do you think it's too difficult to draw a filled rectangle and a text in this area?It may reguire drawing entire tabs by hands.
As discussed long ago there is also quite different approach to this feature. Using colored icons in tab headers. This would also work fine and doesn't even require custom drawing, a dirty hack or a custom control. It even works for all kind of visual styles.
Last edited by Lefteous on 2015-04-27, 13:02 UTC, edited 2 times in total.
I pretty think it is difficult to draw 3D-looked tab header borders to make them look just like in Windows theme.Lefteous wrote:Yes you have to draw the entire tab header client area. Or did you mean something else? I have tried it and that's the way it works. Do you think it's too difficult to draw a filled rectangle and a text in this area?
Where can I see this picture?Lefteous wrote:Here is a picture for illustration. On top you see TWinKey in action and below you see the tab client area in red.
2MVV
1. TWinkey
2. Client area in tab header which can be drawn when using custom drawing in tab control (red rectangle)
3. Icon in tab header (basic feature of Windows tab control, no custom drawing required)
[img]http://fs2.directupload.net/images/150427/dxgpz2n8.png[/img]
It's really just the client area - no necessity to draw the border.I pretty think it is difficult to draw 3D-looked tab header borders to make them look just like in Windows theme.
Sorry here it is. I have added a third image section which illustrates how icons instead of owner drawn client area could look like, so:Where can I see this picture?
1. TWinkey
2. Client area in tab header which can be drawn when using custom drawing in tab control (red rectangle)
3. Icon in tab header (basic feature of Windows tab control, no custom drawing required)
[img]http://fs2.directupload.net/images/150427/dxgpz2n8.png[/img]
While I personally do not use TWinKey, I have to admit, the gradient coloring is beautiful.Lefteous wrote:1. TWinkey
2. Client area in tab header which can be drawn when using custom drawing in tab control (red rectangle)
3. Icon in tab header (basic feature of Windows tab control, no custom drawing required)
[img]http://fs2.directupload.net/images/150427/dxgpz2n8.png[/img]
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks for the owner draw info! But I guess I should use ownerdrawvariable to adjust to the dir name length?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
So there is no WM_MEASUREITEM (and no variable owner-draw) send for tab headers and it's not really necessary.
The tab header width is defined by the elements in the TCITEM structure in the TCM_INSERTITEM message. So you add the tab header including label (or even an icon) as usual and then start drawing in WM_DRAWITEM. You can of course do some tricking in TCM_INSERTITEM by using a very long string to get some space.I guess I should use ownerdrawvariable to adjust to the dir name length?
So there is no WM_MEASUREITEM (and no variable owner-draw) send for tab headers and it's not really necessary.