Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Enterprise Development / May 2008



Tip: Looking for answers? Try searching our database.

Using tabbed windows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Laphan - 10 May 2008 17:14 GMT
Hi All

I might be being a little dim here, but when I use the tabbed dialog of VB6
SP6 to acutally put controls into each tabbed section I have to actually add
'x' amount of frames to my form and add the controls to these frames.

Through code I then show/hide the appropriate frame depending on which tab
is clicked.

Is this correct?

If so why the hell does the tabbed window extend downards as if you could
put things into each tab straight away?

Another thing, how does anybody design a clutch of tabbed windows, as I
don't seem to have the space on my form to neatly display all of the frames
so that I can see them.

At the mo, I keep frantically moving them round, showing, hiding, etc and
it's a nightmare.  How can anybody work this way?

I've seen some apps that have 15 or so tabs does this mean they are fiddling
around with 15 framed windows every time they need to make a change?

Thanks
Ralph - 10 May 2008 18:07 GMT
> Hi All
>
[quoted text clipped - 21 lines]
>
> Thanks

It depends on the "tab" control you are using.

VB6 comes with three:
1) The SSTab is a 3rd Party control from Sheridan Software (recently merged
with ProtoView to become Infragistics).
It is similar to the
2) "Microsoft Tabbed Dialog"
3) And the TabStrip control. This sounds like the one you are using.

The main difference is the SSTab is a CONTAINER. Each tab page CONTAINS the
controls that are drawn on it, and when you switch pages, the controls on
other pages are not visible and the controls on the new tab page become
visible. This makes development easier as if the controls were on a form.
The SSTab also handles all navigation. Convenient, but comes with higher
over-load and limited to only those features provided. It is also very old.

The TabStrip is not a container. The developer has to place controls within
a container such as a Frame or  PictureBox, and manage visiblity and
navigation themselves. Less convenient, but comes with low over-head and
more mangleable.

Also a TabStrip can adopt an "XP Look". The SSTab can not.

That's your trade-off. Essentially all Tab Controls fall into two
categories - a full control, or navigation device.

There are a number of replacement Tabs out there, some free, some at
additional cost, some quite sophisticated with whopping prices. Most
commercial application either use a $$$$ suite or something home-grown.

Here's a nice one based on the SSTab:
http://www.vbsight.com/TBGDialogCTL.htm#SSTab

hth
-ralph
Bob O`Bob - 10 May 2008 21:33 GMT
> The main difference is the SSTab is a CONTAINER. Each tab page CONTAINS the
> controls that are drawn on it, and when you switch pages, the controls on
> other pages are not visible and the controls on the new tab page become
> visible. This makes development easier as if the controls were on a form.

This is a poor description.

Using terms "visible" and "not visible" is very likely
to lead to an entirely wrong interpretation.

SSTab switching never affects the Visible property of any control,
unless someone adds code to explicitly do so.

SSTab principally manipulates the Left property of each directly
contained controls, using the SSTab window as a clipping region.
Which is why it is massively unwise to write code intending to
reposition any control which is contained /directly/ by any SSTab.

But the simple rule of thumb of always placing exactly one
container control on each tab, and everything else on those,
solves that, and makes SSTab a very reliable and easy to use
control.

    Bob
--
MikeD - 12 May 2008 00:09 GMT
> It depends on the "tab" control you are using.
>
[quoted text clipped - 5 lines]
> 2) "Microsoft Tabbed Dialog"
> 3) And the TabStrip control. This sounds like the one you are using.

I gotta go with Bob on this one, Ralph. I think you dropped the ball.  In
addition to what Bob said, VB6 does NOT come with 3 tab controls....it comes
with 2...the TabStrip (part of Windows Common Controls 1) and the SSTab (by
itself as the Microsoft Tabbed Dialog Control). IOW, SSTab and Microsoft
Tabbed Dialog are 2 ways to refer to the same control.  *Perhaps* SSTab is
also the control name for a 3rd party control from Sheridan (or whatever the
company is called now).  But even in that case, it wouldn't be a control
that comes with VB6. It'd be an enhanced version that was 3rd-party.

Signature

Mike
Microsoft MVP Visual Basic

Ralph - 12 May 2008 03:10 GMT
> > It depends on the "tab" control you are using.
> >
[quoted text clipped - 14 lines]
> company is called now).  But even in that case, it wouldn't be a control
> that comes with VB6. It'd be an enhanced version that was 3rd-party.

With all due respect. I don't think I dropped all that much. But guys are
the experts.

I doubt anyone confuses a design-time change in visibility with the runtime
Visible property. But perhaps I should have said "automatically becomes
unseen" or "automatically becomes seen".

True the SSTab is the "Microsoft Tabbed Dialog Control" and they are the
same
component as included with VB. (It was developed by Sheridan bought by
ProtoView, then Infragistitics. I have always had the full Sheridan suite
around, thus sometimes forget what is included and what has been added.)

Whatever little remains of my response is essentially true. With any "tab"
control - one has the choice of a full container or a navigation tool. One
is easier on development, the other usually more malleable. <g>

-ralph
expvb - 10 May 2008 18:53 GMT
I assume that at design time you have the form maximized so you can see all
frames, and you put the frames side by side in a grid fashion?

You need to use a control array for your frames to make less code. In
Form_Load, loop through all frames and set all Visible property to False
except the first one, then position them on top of each other. Example(air
code):

Private m_CurFrame As Integer ' Current Frame visible

Private Sub Form_Load()
   Dim i As Long

   For i = 0 To fraOptions.UBound
       If i = 0 Then
           fraOptions(i).Visible = True
       Else
           fraOptions(i).Visible = False
       End If
       fraOptions(i).Left = 60
       fraOptions(i).Top = 60
   Next

   m_CurFrame = 0 ' First frame

End Sub

Below is all the code that you need to handle tab clicks regardless of how
many tabs that you have:

Private Sub tabMain_Click()
   If tabMain.SelectedItem.Index = m_CurFrame Then
       Exit Sub ' No need to change frame.
   End If
   ' Otherwise, hide old frame, show new.
   fraOptions(tabMain.SelectedItem.Index).Visible = True
   fraOptions(m_CurFrame).Visible = False
   ' Set m_CurFrame to new value.
   m_CurFrame = tabMain.SelectedItem.Index
End Sub

If the form is resizable, you need to add some code to resize the tabs
similar to what is in Form_Load.

Finally, if you prefer to refer to the frames by name; and I can't think of
many reasons in how to do this, use the following code which was suggested
by Ralph in another thread:

Private Enum Tabs
   eTabGeneral
   eTabNetwrok
   eTabAdvanced
End Enum

You could refer to it like this:

fraOptions(Tabs.eTabNetwrok)

Personally, I put the frames apart in a maximized form, but once I am done,
I put the frames in top of each other, and use Format-->Bring to Front/Send
to Back, so I don't have to maximize the form or put any code in Form_Load
event.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.