Results 1 to 10 of 10

Thread: [vbRichClient] TabStrip Control (Firefox-like)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    [vbRichClient] TabStrip Control (Firefox-like)

    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:


    Name:  ts.jpg
Views: 2017
Size:  17.9 KB
    Attached Files Attached Files
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  2. #2
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: [vbRichClient] TabStrip Control (Firefox-like)

    Impressive! Thanks for posting this! I'm playing around with it a bit now and it looks very solid so far

  3. #3
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    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?

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: [vbRichClient] TabStrip Control (Firefox-like)

    Probably an oversight on my part. I'll investigate and post back...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    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...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  6. #6
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    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:
    Name:  RC5 - A.jpg
Views: 907
Size:  7.3 KB

    First Click:
    Name:  RC5 - B.jpg
Views: 965
Size:  7.1 KB

    Second Click:
    Name:  RC5 - C.jpg
Views: 932
Size:  7.9 KB

    I'm using vbRichClient version 5.0.38 (AFAIK the latest version). What version are you using?

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    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...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  8. #8
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    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

    ButtonBackground ' Unselected/unhot button background colour
    ButtonForeground ' Unselected/unhot button text colour

    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!

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    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...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  10. #10
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width