Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SStab control tab widths

Status
Not open for further replies.

SteveMac32

Programmer
Jan 25, 2002
74
0
0
GB
I have a program that dynamically adds tabs to the SSTab control, I will not know their captions and so will not know there widths.

The problem is that at the moment the program is running
.TabsPerRow = .TabsPerRow + 1
.Tabs = .Tabs + 1
.TabCaption(.Tabs - 1) = sCaption

So as you can see as the tab count grows the tabs will fall of the end of the control and not be visible due to the ever increasing TabsPerRow and the control not being wide enough.

What I need to do is somehow find the width of the tab and deduct this from the width of the control (held in a variable) when it reaches say <200 then start a new row and start this process all over again.

The only solution I can think of is setting the TabMaxWidth but this will introduce its own errors of truncating some text and possibly a messy uneven look to it.

Thanks in advance

Steve
 
googling "site: vb6 character width" yields numerous threads on measuring the width of characters, incuding this one thread222-1036091 up top which may be an approach that you can use.
 

Or….
1.If you can predict the ‘worst scenario’ as far as the length of the captions and if, let’s say it turns out to be 5 tabs per row, that’s what’s going to be.

2. Re-think your user interface, maybe instead of Tabs, user can select from DropDownList instead. Easy to make it in alphabetical order.

Just my $0.02

Have fun.

---- Andy
 
Andy's first idea is giving me other ideas. If the tabs are all a uniform size, and the size of the caption varies, that will still make good ergonomic sense. Users will quickly get used to the uniform tab size and be able to easily select what they are looking for. On the other hand, if you have a heck of a lot of tabs as you seem to do, that real estate becomes more valuable so you may want to vary the sizes of the tabs to some degree. I would be careful to keep from making them too small as well as too large, and work out something to accomplish that.

 
Thanks all, I ended up opting just to set the TabsPerRow and see how they get on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top