April 29, 2024, 07:04:19 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Tab controls

Started by Andy, December 19, 2020, 05:29:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

December 19, 2020, 05:29:38 AM Last Edit: December 19, 2020, 05:32:19 AM by Andy
I have used tab controls before and they look promising for my next editor upgrade (next year of course), but I have some questions that I can't seem to find the answers for.

Attached is a tab control program with a rich edit control in it.

My idea (for next year) is to modify the editor to use tab controls instead of buttons.

Question 1.

Why is the space to the right of the tab control white (or grey when you don't set a widow colour)?

Question 2.

What makes the selected tab's text white ?

Question 3 (relating to question 1).

How can I change the white area (not text) to a specified colour?

Tabs for me look promising, but would like to be able to customise them first before I spend a lot of time upgrading the editor program.

Yes I spelt "Fourth" wrong - thanks sharp eyes Brian!

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Think it's something to do with the system colour, so I have decided to try something else...

1. I can get the width of each visible tab name, add them together for a total length.

2. I can then set an empty static on the right hand side of the tabs to colour that part.

This actually works, although I need to do some more for when you say delete / add tabs.

NEXT PROBLEM:

Changing a tabs text...

There is a documented bug about changing a tab's text (the title), it apparently inserts a new tab instead of changing the text.

However, IF you know the tab's text you can simply delete the tab, and then insert a new one in the same place with the new title - looks okay to me.

I had to do it this way as I could not head nor tail of the API commands.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

Just a thought and it might not work, but might be worth a try.

Colour the entire area where the tabs are to be and then create the tabs.  It might not work, but it might.  That way you don't have to calculate the size of the tabs.

Bill
When all else fails, get a bigger hammer.

Brian

That was one of my thoughts, Bill - I tried it, no banana!

Brian

aurelCB

You can do it using DC as with any other control but require lot of api code


aurelCB

December 21, 2020, 11:53:30 AM #6 Last Edit: December 21, 2020, 12:06:25 PM by aurelCB
Guys
I am not sure but i think that work ...
Using bitmaps is the easiest way to change tab colors

or this
https://www.codeproject.com/Articles/14712/Win32-SDK-C-Tab-Control-Made-Easy

Andy

Thanks for all the replies.

Firstly, sorry I could not get back to any one yesterday, Anne gets a lot of requests for Christmas cakes, chocolate logs, mince pies etc and just as she thought she'd finished making them all two late requests came in - so I hand to lend a hand.

By the time it was all done I was not fit for anything else!

You have all posted interesting ideas etc, so today I need to read these and play around with your ideas.

Thanks for replying,
Andy.
 :)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.