Here is my take on a modern browser-like TabStrip, which incorporates all of the features found in such controls such as animated open and closing of tabs, drag and drop to re-arrange, etc.
The important files in the demo are cwTabStrip.cls and cwTabStripButton.cls which are the 'engine' of the control itself. cTabStrip.cls is just a thin wrapper around these in order to expose the public interface
The TabStrip can be initialised with the following boolean parameters UserCanAddTabs, UserCanCloseTabs, UserCanDragTabs which govern the behaviour of the control and mean that it can (if wanted) be used as just a regular tabstrip that the user cannot change.
And here is the demo:
If you don't know where you're going, any road will take you there...
Re: [vbRichClient] TabStrip Control (Firefox-like)
One thing I've just noticed - if you set the HoverColor it seems to draw all of the text and borders in that colour. AM I misunderstanding how it should work?
Re: [vbRichClient] TabStrip Control (Firefox-like)
Hmmm. Nowhere in the public interface can you set the hover colour except (indirectly) in the public SetColours method where it is passed in as ButtonHotColour - and that works as it should?
What exactly did you do, please, jp?
If you don't know where you're going, any road will take you there...
Re: [vbRichClient] TabStrip Control (Firefox-like)
Hi Colin,
Didn't do anything except click the area above the tabstrip - it changes the background to yellowish, and all the text and lines became red. Clicking it again restores the background colour, but the background colour, but the text remains red. See the following images:
Startup:
First Click:
Second Click:
I'm using vbRichClient version 5.0.38 (AFAIK the latest version). What version are you using?
Re: [vbRichClient] TabStrip Control (Firefox-like)
The RC5 version is not the issue (though I am using v5.0.36). The reason that it's all showing as red is that I (un-wisely!) set both the BorderColour and the 'CaptionColour' to red in the form code, as below
Code:
Private Sub Form_Click()
If Me.BackColor = vbButtonFace Then Me.BackColor = &HC0FFFF Else Me.BackColor = vbButtonFace
mTabStrip.SetColours picTabContent.BackColor, Me.BackColor, vbRed, vbGreen, vbRed
End Sub
Change either of those and you will see that they do, in fact, behave independently...
EDIT: Should point out that, inside the demo form, I didn't go to the trouble of restoring all the colours in a toggle-like fashion. It was merely meant to be an illustration of the fact that the colours are configurable.
Last edited by ColinE66; Jan 20th, 2016 at 03:14 PM.
If you don't know where you're going, any road will take you there...
Re: [vbRichClient] TabStrip Control (Firefox-like)
Okay I see that, thanks. But I guess the part that is confusing me is the "Hot" colour - I'm expecting that to change the text colour when the mouse is over the button, but I don't see that happening. I might just be misunderstanding the purpose of that colour though.
In some other components I've used, there's often 2 colours for each state such as:
ButtonHotBackground ' Background colour when mouse is over
ButtonHotForeground ' Text colour when mouse is over
ButtonSelectedBackground ' Background colour when tab is selected
ButtonSelectedForeground ' Text colour when tab is selected
Anyway, I'll poke around at the code a bit to see if I can figure out the colour handling myself since you've said it's working as designed - just different from what I'm used to!
Re: [vbRichClient] TabStrip Control (Firefox-like)
The 'hot' thing only applies to the scroll left/right and the AddTab buttons, though it could be implemented, in addition, for the tabs themselves. I just didn't see the need...
If you don't know where you're going, any road will take you there...
Re: [vbRichClient] TabStrip Control (Firefox-like)
I see - it's just the "hot" terminology that confused me. To me that word implies that it will use that colour when an item has the mouse hovering over it. Now I understand its usage here, thanks!