tabs

Inardesige
10-24-2001, 07:07 AM
how do i switch to a different view on a tab strip during runtime? i can do it with a sstab, but not a tab stip, is there some trick to it?

Flyguy
10-24-2001, 07:29 AM
The TabStrip control doesn't do anything but showing tabs on the screen.

You have to add code to the TabStrip1_Click and check the TabStrip1.SelectedItem.Index to see which Tab has been activated.
All code to change the screen have to be done by yourself.

Inardesige
10-24-2001, 07:31 AM
my fault i meant during design time

Flyguy
10-24-2001, 07:37 AM
Different view when in design time ??? Explain, please!

Inardesige
10-24-2001, 08:28 AM
well i want to be able to change the tab during design time so i can put its controls on it, but unlike an sstab, a tabstrip won't let you click a tab and see just the page for that tab so that you can put controls on it

Thinker
10-24-2001, 08:54 AM
You can't put controls on a tab strip. You have to do everything in
code. That is why people prefer the sstab.

Flyguy
10-24-2001, 01:19 PM
Exept me, but maybe I just a love to have a hard time images/icons/wink.gif
No the real reason is, yet another OCX to include... I hate that...

Garry Clarke
10-30-2001, 05:58 PM
As a newbie i do not get much of a chance to help people so time for me to get that chance.

I am working on a similar thing at the moment and what i found was that you create a pic box for each tab then add all your controls to the pic box. at design time you then change the left property of the pic box to say -20000 to remove the box you dont want then set toe left on the one you want to bring it into view.

then add this code to your form so at runtime when the user clicks on the tab the correct pic box is displayed.
' displayes the correct picture box from the picConnections control array.
Private Sub tabMain_Click()

Dim i As Integer
'show and enable the selected tab's controls
'and hide and disable all others
For i = 0 To tabMain.Tabs.count - 1
If i = tabMain.SelectedItem.index - 1 Then
' make the correct picture box visible.
picTabMain(i).Left = 250
picTabMain(i).Enabled = True
cboArtist.Visible = True
lblSelectArtist.Visible = True

Else
' hide the other picture box.
picTabMain(i).Left = -20000
picTabMain(i).Enabled = False

End If
Next


End Sub

Hope this helps
Garry

Flyguy
10-31-2001, 12:47 AM
Hai, this is a technique I do use myself, but instead of moving the picture box I set it's visible property to False.

But anyway thanks for sharing!

biogenesis
11-12-2001, 05:14 AM
Yes I also use that code and you can see an example of that through the vb application wizard and looking at the options form's code.

You can also use picture box to make a custom tab.

Banjo
11-17-2001, 10:03 AM
The problem with moving stuff to -20000 is that it can become really hard to code with re-sizeable forms. Using make visible/invisible method keeps the re-size code and the tab selection code completely separate.

walid bahgat
11-24-2001, 03:23 AM
i think u can put the tab control to an ActiveX Control and put the codes that u use in run time and after that make it ocx tool
then it's ur's my friend it will run in design time or run time

good bye

divil
11-30-2001, 05:24 AM
Use a tabstrip rather than sstab, that control is bloated and unnecessary. Tabstrips aren't difficult to get working. If you use a control array of frames or pictureboxes, they are very effective.

Tabstrips also have a mouseover effect which I like :) Don't move things to hide them, they have a .visible property specifically for that.

You could even create a Tabstrip with the API, its quite difficult but you won't have *any* dependancies if you do it.

divil
11-30-2001, 05:26 AM
Having just realised I completely forgot to answer your question, you set which tab is active on a tabstrip like this:

Set tabstrip.SelectedItem = tabstrip.tabs(index)

Banjo
12-01-2001, 04:43 PM
I agree with your comments in general, but there are a couple of reasons for using SSTab. Firstly, although not hard, manipulating the TabStrip at design time is nowhere near as easy as the SSTab. The second one is the way they handle large numbers of tabs. The SSTab uses multiple rows whereas the TabStrip has a spinner on the right hand side. I personally prefer the multiple tabs.

dcl3500
12-01-2001, 05:19 PM
Not to mention the fact that one of the reasons we have the ability to use and create controls is so that we don't have to reinvent the wheel each time we want to use it. I use the sstab and other controls not because I can't do (most) of the same things they do through my own sweat but because I don't get paid to spend my time typing the same old sh** over and over again. Yeah they add a bit more overhead sometimes and yes they can occaisionally be a pain in the butt to include but the benefits outweigh the drawbacks IMHO. The purists out there that say "oh you should write your own" just come off as effete snobs (again IMHO.) Hell why not just write in assembler and do away with all the benefits gained with visual programming? images/icons/wink.gif

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum