????Attachment 148455
Printable View
looks fine on my system, what res and scale are you running, Possible large or extra large fonts enabled.
Running Windows 7 @1920x1080 125% it wraps the text after the de
Hi, thank you.
I'm using XP SP3 @1920x1080 125% (120 DPI).
I have extra large fonts for the Windows setting... but how that can be related to the issue?
Eduardo
Perhaps you could more clearly explain what the issue is.
Spoo
Comes out correct on mine, as well: 1366 X 768 Windows 10
Eduardo
Yeah, I belatedly figured out what your issue might be .. :blush:
I can't replicate your issue, but I tried this code frag ..
,, and got these results ,,Code:With SSTab1
.TabHeight = 400
.TabMaxWidth = 1500
.Tab = 0
.Caption = "configuraciondepagina"
.Tab = 1
.Caption = "configuracion de pagina"
.Tab = 2
.Caption = "configuracion" & vbCrLf & "de pagina"
.Tab = 0
End With
Attachment 148461
Unfortunately, in all cases, the text is centered.
As I said, I couldn't replicate your definitely odd situation of
,, left justified top line with weird place to "split" the word
,, centered second line
EDIT:
BTW, my res is 1280 x 1024, Win 10.
Spoo
I would say it is the extra large fonts that is the source of the issue.
You likely need to make the tab larger or the font smaller
Thanks to everybody that took the time to run the sample project.
So far it seems that the issue only happens to me.
I changed to standard fonts and the issue still happens.
I also changed to 96 DPI (100%), removed the Windows theme and set it to classic Windows, but I got the same result:
Attachment 148463
About changing the font, it only get fixed when the font is small enough to get all the text to fit in a single line (tested with Arial and MS Sans Serif).
What is the TabCtl32.Ocx file version that you have?
Mine is: version 6.1.98.16 of March 24, 2009.
File date time is: 02/16/2010 3:22 PM
File size: 216 KB (221.504 bytes)
I have SP6 installed and the Cumulative Update of 08/16/2012 (VB60SP6-KB2708437-x86*.msi)
Just move to the TabStrip instead.
As part of the system Common Controls it themes to fit the OS instead of looking like some refugee from a Windows 3.1 program.
Version 6.0.81.69
6/24/1998
SP6 Installed, no Cumulative update installed
Correction:
Version 6.1.97.82
3/8/2004
I was looking on the wrong drive before. The one mentioned at top has no SP installed.
Attachment 148465
I prefer the SSTab.
Reasons:
1) Less code to set up.
2) WYSWYG
3) Order to have the controls at design time.
Cons: no Windows theme.
I have the pending task (may be forever) of to make an SSTab direct replacement able to display with the Windows theme.
Krool is already replacing most of the controls, may be some day he also wants to make the SSTab.
Sounds like the cumulative update may be the culprit here.
There have been several warnings related to those updates advising to not install them.
Yes, it seems so.
I know that there were one or more updates that were buggy.
To my understanding, the recomendation was to install just that one after the SP6.
Now I don't remember who said that, probably it was in the microsoft.public.vb.general.discussion newsgroup.
May be I should open a new thread to discuss (and ask) whether to install or not to install that update.
I would say that you should have SP6 installed but not any of the later updates.
The thing is that I've been using it (that update) for several years already, without any issue that I'm aware of (other than this one now), and starting now using just SP6 I'm not sure if that will introduce any bug or change in behavior to the programs that I make newer versions of.
About the SStab issue I "fixed" it changing its Style to property page like.
It is not what I wanted, but now it displays the text correctly (all in one line, whithout wrapping).
Eduardo
Just out of curiosity, what happens if you "force" the split with a vbCrLF"
SpooCode:Caption = "configuracion" & vbCrLf & "de pagina"
BTW, regarding ,,
I haven't used TabStrip or Frame controls, but I can think of 2 other Pros:
4) It is a container ,, TabStrip is not
5) Look and feel .. it "looks" like a tab.
Attachment 148481
Spoo
Krools controls have a tabstrip control that uses the common controls tab *and* doesn't have your 3 concerns. The 'windows theme' you cite is more important than you suggest too because of DPI and other issues. SSTab is really not something that should be used these days, especially with Krool's tab control just as easy to use.
I'll throw my two-cents in just for grins.
Personally, I love the SSTab control, specifically because it's so WYSIWYG. And, for me, it's a fairly bullet-proof control. As can be seen in form pics in other threads, I make frequent use of it. I will admit that I try to keep my tab captions short enough to fit on one line, so I haven't really seen the problems that Eduardo is having.
I've thought many times of using a combination of the PictureBox and the TabStrip to make a WYSIWYG tabbed custom control out of them. It doesn't seem terribly difficult. I just have never taken the time to do it.
The only problem I've found with the SSTab control is that it occasionally gets a bit confused about TabStops, especially when you have containers on the different tab-bodies. Here's a little class I always use when I'm using the SSTab control that fixes that problem:
I've also got code worked out that allows you to dynamically (during runtime) change the tab that any particular control is on. It's in the codebank.Code:
Option Explicit
'
Dim WithEvents tabCtl As SSTab
Dim frm As Form
Dim TabStops() As Boolean
'
' A primary purpose of this fix is to correctly control the tab stops.
' To make the appearance of tabs, the SSTab control simply moves the controls out of view.
' An artifact of this approach is that the controls are still able to get the focus when the
' user uses the TAB key. The following code corrects this problem by appropriately turning
' on and off the TabStop properties of the controls as the user tabs from one tab to another.
'
' Another problem has to do with ComboBoxes. When changing to a new tab, dropdown comboboxes
' will have their text selected. The combobox will not have the focus, but their text will be
' selected. The primary problem with this is that it right-justifies the text when there is more
' text than will fit in the textbox portion of the combobox, and this is confusing to users.
' This problem is corrected in the following code.
'
Friend Sub SetTabControl(TheTabControl As SSTab, TheForm As Form)
' Call this in the form load event.
Dim ctl As Control
Dim Ptr As Long
'
Set tabCtl = TheTabControl
Set frm = TheForm
'
' Store the true value of the TabStops.
ReDim TabStops(0 To frm.Controls.Count - 1)
' Not all controls have TabStop property, so we must set error trapping.
On Error Resume Next
For Ptr = 0 To frm.Controls.Count - 1
TabStops(Ptr) = frm.Controls(Ptr).TabStop
Next Ptr
On Error GoTo 0
End Sub
Friend Sub SetTabStopsAccordingly()
' Call this in the form activate event.
' After this first call, it will automatically be called when the tabs change.
Dim ctl As Control
Dim ctlTheControlOrContainer As Control
Dim ItsOnTheTabControl As Boolean
Dim Ptr As Long
'
For Ptr = 0 To frm.Controls.Count - 1
Set ctl = frm.Controls(Ptr)
Set ctlTheControlOrContainer = ctl ' The control might be on a container that's on the SSTab, rather than directly on the SSTab.
Do
Select Case True
Case TypeOf ctlTheControlOrContainer.Container Is SSTab
ItsOnTheTabControl = True
Exit Do ' The way out.
Case TypeOf ctlTheControlOrContainer.Container Is Form
ItsOnTheTabControl = False
Exit Do ' The way out.
End Select
Set ctlTheControlOrContainer = ctlTheControlOrContainer.Container ' Must deal with controls nested deeper than the SSTab control.
Loop
If ItsOnTheTabControl Then
' Not all controls have TabStop property, so we must set error trapping.
On Error Resume Next
If ctlTheControlOrContainer.Left >= 0 Then
ctl.TabStop = TabStops(Ptr) ' If it's showing, restore the original TabStop value.
' Must also fix the problem with combo boxes having an internal focus set.
ctl.SelStart = 0
ctl.SelLength = 0
Else
ctl.TabStop = False
End If
On Error GoTo 0
End If
Next Ptr
End Sub
Private Sub tabCtl_Click(PreviousTab As Integer)
SetTabStopsAccordingly
End Sub
Private Sub tabCtl_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
' This allows other controls to close up when user click off.
' The problem is that clicking into the body of the tab control does NOT cause change in focus.
' The control with the focus keeps it, and it may not close up as typically happens when clicking on dead space of a form.
' You may also want to consider placing this "SetFocus" code on the labels on the tabs. This is NOT automatically done
' because the programmer may want to use a label click for other purposes.
tabCtl.SetFocus
End Sub
All The Best,
Elroy
EDIT1: If you intend to use the above class, the easiest way is to throw that code into a CLS module, then declare that module as something like this (Dim oSSTabFix As New Class1), and then call it as instructed in the comments. It should self-destroy when your form closes it's Code/COM object.
EDIT2: Very quickly, here's how I use it. Let's say the above class is named "clsFixTabCtl". In that case, I'd have the following line at module level in any form that had SSTab:
And then in Form_Load, I'd have:Code:
Dim oFixTabControl As New clsFixTabCtl
And then in Form_Activate, I'd have:Code:
oFixTabControl.SetTabControl tabSomeSSTabControl, Me
And that's it. After that, the SSTab control works perfectly.Code:
oFixTabControl.SetTabStopsAccordingly
Don't use PictureBox with TabStrip, create UserControls as panels.
The bonus is that you pull tons of logic out of the client Form into separate modules. This reduces the rat's nest and makes your programs far easier to maintain.
SSTab is a refugee from VB 3 and 640x480 monitors.
I don't know about Krool's tabstrip control, but AFAIK he makes direct replacemente of the controls, so his tabstrip I presume would work in the same way of the original, having the same issues.
I don't have time now to take a look, I'll do it in some other time.
The windows theme has nothing to do with DPI but with the look, also AFAIK.
The original SStab doesn't have issues with DPI settings that I can remember.
Other than it doesn't support the Windows theme, that I don't think it is so important as you do, I don't see many issues.
It doesn't look bad, changing the fonts from MS Sans Serif to a TrueType like Arial or Microsoft Sans Serif, that is what I do for the whole program.
On the other side, just applying the Windows theme, the tabs controls doesn't look much more modern either.
I'm sorry I disagree in everyting you have said.
I recently tried to check how I could do the SSTab replacement, and I found a problem:
The SStab, for being as it is, it must be possible to click in the tabs at design time.
So it means that the control must run at design time.
To run an UserControl at design time, there is a property EditAtDesignTime that must be set to True.
But, even with that, for the control to run at design time, the developer needs to right click on the control and select "Edit" from the context menu, something not desirable at all.
I didn't find a way to overcome that.
It may not be possible to write a direct replacement of the SSTab in VB6.
Edit:
I didn't find a way to force this editing mode.
Eduardo
Man, that IS weird .. boo
And it is not what I encountered when I used vbCrLF on Tab 2 in my post #7.
What happens if you increase .TabHeight?
Also, what happens if you just use "standard" letters .. ie, no accents, no cidellas
(I'm not sure of the terminology, but I guess that it is "language" related and has
to do with specifying UniCodes).
Spoo
OK ,, no luck there.
How about the "language" issue?
Could you post the code frag that enables that .. I've never done that before.
EDIT ..
Doing a little bit of checking up on Help, I see that this may be referred to
as double-byte character set (DBCS), as opposed to ANSI.
Actually, I wonder if that is why you are getting 2 squares.
I found this info in Help .. don't know if it is germane ..
SpooQuote:
Processing Files That Use Double-Byte Characters
In locales where DBCS is used, a file may include both double-byte and single-byte characters. Because a DBCS character is represented by two bytes, your Visual Basic code must avoid splitting it. In the following example, assume Testfile is a text file containing DBCS characters.
,,,
When you use a String variable with Input or InputB to read bytes from a binary file, Unicode conversion occurs and the result is incorrect.
Hello Eduardo,
working with the Tabstrip isn't that much work to Setup
here a Sample with Tabstrip and Frames
Attachment 148635
regards
Chris
I don't know what you mean. There is no code at all, other than the line for the test you've requested:
That's has nothing to do with Spanish, Spanish uses just ANSI, that means one byte per character.Code:sst1.TabCaption(0) = "Configuración" & vbCrLf & "de página"
And without the accent marks it is the same:
Attachment 148639
Well you're free to disagree all you want, but I'll make my case with a picture of my most recent tabstrip
http://i.imgur.com/xSnYA1X.jpg
:wave:
Hello Eduardo,
in my last post I made a sample with Tabstrip an Frames. I isn't that much work to set the Tabstrip up
Code:Private Sub Form_Load()
Dim i As Long
Dim x As Single
Dim y As Single
With TabStrip1
.Width = 8000
.Height = 6500
.Top = 1150
.MultiRow = True
.Left = (Me.ScaleWidth - .Width) / 2
'sort the Frames to Tabstrip
For i = 0 To Frame1.UBound
Frame1(i).Height = 6000
Frame1(i).Width = 7500
Frame1(i).Left = .Left + (.Width - Frame1(i).Width) / 2
Frame1(i).Top = .Top + 210 + (.Height - 210 - Frame1(i).Height) / 2
Frame1(i).Visible = False
Frame1(i).BorderStyle = 1
Next
End With
For i = 0 To Label1placeholder.UBound
Label1placeholder(i).Visible = False
Next
' show 1. Frame
Frame1(0).Visible = True
End Sub
Private Sub TabStrip1_Click()
Dim i As Long
For i = 1 To Frame1.UBound
Frame1(i).Visible = False
Next
i = TabStrip1.SelectedItem.Index
Frame1(i - 1).Visible = True
If i = 2 Then
MsgBox "you clicked Tab2"
Else
' cmdFotoshow.Visible = False
End If
End Sub
regards
Chris
I wonder how does people do at design time with TabStrip in cases, for example:
A form that is almost the size of your current developing screen.
You have a TabStrip of, let's say 6 tabs, but may be less that occupies almost all form's size.
How do you manage to place all those Frames or PictureBoxes that are containers of each tab of the TabStrip on the form?
Don't tell me that you use a SStab to store them, just for the design time... LOL
This thread is encouraging me to write a real SSTab replacement.
I think the problem that I outlined in the message #28 could be solved with subclassing.
Update February 2018: For anyone reading this thead, here is the replacement.