????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.
Hello Eduardo,
to design your form with Tabstrip look at the Form_load code, there you give the size of the Tabstrip and thenQuote:
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?
the size of the Frame.
where is the problem ?
regards
chris
here a example
just put Frame 2,3 and 4 to the bottom of the form make them as small as a Textbox.
take Frame 1 and set the height to 5900 , set the widht to 7400
this is the designspace !
place you textboxes, Labels, Pictureboxes where you want them
now run the program.
everything looks Ok, make Frame 1 as small as a Textbox, put it at the bottom left.
no do the same with Frame 2
etc...
regards
Chris
How do you deal with tabbing anomalies `SSTab` introduces? e.g. when you have two `TextBox`es on first and second tab of an `SSTab` control the end-user is able to navigate with {Tab} key to the currently invisible `TextBox`!
The reason for this unfortunate behavior is that on tabclick `SSTab` control only moves contained controls in and out of sight (left to right and back), w/o setting visibility or WS_DISABLE flag.
The most common (and best) way to deal with this problem is to place a single `PictureBox` for each tab (or just a control array of `PictureBox`es) and show/hide these second "manual" containers on tabclick.
Provided that you already need to use `PictureBox` containers to fix `SSTab` problems, including handling `picTab` visibility through code, it's just a single step forward to just ditch `SSTab` in favor of a (themed) `TabStrip` control.
When designing forms with `TabStrip` and `PictureBox`es for each tab, `Ctrl+J` shortcut (Bring to front) comes very handy -- just select tab's `PictureBox` from the combobox in `Properties` windows and bring it up.
cheers,
</wqw>
Hi wqweto. Take a look at my post #24. I've used that class with the SSTab control for years, and it makes it bullet-proof as far as I can tell (with no need for PictureBoxes). In addition to tabbing, there's also a bit of a problem with ComboBoxes, which is also corrected by that class (see comments in class code). I'll also edit that post to give a brief example of how I use the class.
Take Best Care,
Elroy
I don't deal with it.
I just set all the tabindexes in order and if the user wants to navigate with tabs, he will have to click on the first control every time he changes the tab.
In my life I never knew of any user who uses tabs to navigate (I do from time to time press the tab key to move to other control).
I also put all the caption's accelerators, another feature that perhaps is never used.
Many times (not always) I put a borderless picturebox on each tab as a container, mostly because if later I want to add a new tab between other existent tabs, it is easier this way.
No. With SSTabs you can have the controls contained on each tab at design time, that's the main feature that you don't have with TabStrip.
There is no problem with `ComboBox`es when using separate container-per-tab strategy -- at least in a simple test I did here (I've not been using `SSTab` for quite some years now).
But both `SSTab` and `TabStrip` controls are distinctively missing focus-first-visible-child functionality. It's pretty useless for a tab control to remain focused on tabclick (or Ctrl+Tab/F6 tab switch) IMO.
cheers,
</wqw>
I see you point. Unfortunately this does not work for me or any other professional, because we can't be bothered to use `SSTab` control only because it's easier for us devs to implement it and in the processes end up with a solution that makes our end-users lives miserable.
cheers,
</wqw>
Nobody makes the end user's life miserable. If you din't read the first time, I'll repeat: they don't use tabs to navigate.
I have to say that I'm not talking about data entry screens, I use tabbed controls mainly on to scenarios:
1) For configuration screens.
2) To show information ordered by subject.
In the fist case the end user usually needs to click in the field that he wants to change.
In the second case they usually only need to read.
Of couse, I'm not saying that it is not desirable at all to have that fixed, but it's almost unimportant since nobody will note it.
If the forms were data entry screens, in that case I agree that the feature is relevant.
Well, I shouldn't jump in, but it's Friday and I'm coasting a bit, so I will.
I use the SSTab for data entry screens all over the place, and I love them and my users do too. I'm bewildered as to what the problem is.
Wqweto, I like much of the code you've written around here, but we've got to agree to disagree on this one.
If we push those thoughts to their logical conclusion, we may as well return to using Notepad-type code editors because they allow us maximum flexibility to write the best code for our users. Also, I'm not sure that making things easier for coders and making them easier for users is an antithetical tension. I will agree that that's true in some cases. For me, the idea of bound controls comes to mind, which I can't stand (although I suspect there are those who will even disagree what that).
However, ideally, ease for the coder and easy/intuitive programs for the users can rise in a mutually beneficial way. I certainly believe that the ability to design forms via select-and-draw from the ToolBox is an example of this. I'd hate to think that I'd have to write all of my form-design code in notepad.
For me, a tabbed dialog that's WYSIWYG at design time is a natural extension of this.
People may point out that the SSTab can't be themed, and is looking somewhat dated, but those aren't concerns to me. For my application, I'm much more concerned with user functionality and ease of design. And the SSTab provides both of these in spades (IMHO).
To All, Have a Great Weekend,
Elroy
FWIW, I've just finished a replacement of the SSTab - still with a few rough edges I guess, but it should work
as a direct replacement for the most common use-cases (feel free to enhance it ... + a post-back of your changes into the
code-bank thread here: http://www.vbforums.com/showthread.p...-and-VB-Frame)
would be nice...
http://www.vbforums.com/images/ieimages/2017/06/1.png
Olaf
Hey, it's ok to like my code and disagree on my oppinions in random threads :-))
But do you take care of keyb tabbing in your SSTab-ed forms? Do you fix tab order when you move controls around at design-time?
Not doing the first one and not caring about the second one makes end-users lives miserable. Both of these can be impl w/ SSTab control per se with some additional code and some attention to detail on devs part. Certainly not doing it would be easier for us but this can't be the only reason one uses SSTab control -- ease of use for *developers*. . .
cheers,
</wqw>
Hi wqwewto,
Absolutely, to the first question. That's what that class is all about in post #24. Regarding your second
Nope, but I'm not sure anything does that. That doesn't happen even if you're not using any containers at all. In some ways, that harks back to this thread, and a specific case where I designed a complex form and didn't want to mess with the TabIndexes.
You have a GREAT day,
Elroy
If you move a control, let's say from the top of the form (or the top of a SSTab tab) to the bottom, the TabIndex property of the control doesn't change, so when the design of the form is finished, the developer should put the proper values for every TabIndex of every control.
Also if you add accelerators to the labels, every label should have a tabindex with value of the control that will access -1.
Thank you very much Olaf.
Now I'm away from home and don't have VB6 here, I'll test it next week when I'm back.
PS: I guess that "Tab" was a reserved VB6 keyboard because you needed to change it to SetTabIdx.
Just an idea: Could it accept that keyword as a property name using a typelib?