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!

Anybody have this STRANGE problem?

Status
Not open for further replies.

dalec

Programmer
Jul 8, 2000
191
0
0
US
I have built a form with an sstab on it, a customer wanted some text boxes moved around just for them. So, I programmically moved the text boxes and lables around and adjusted the tab orders.

HERES the STRANGE Part;

When I run the program all the boxes I programmically moved are shown through each tab. (they appear as if they were on the form not the container (SSTAB)). Is there some rule about programmically moving text boxes around that I missed?

Any Ideas?

Thanks,
Dalec
 
Update: The form has 3 tabs, the textboxes show through the first two but not the third. Everything is fine when there drawn on, but this happens when there programmically moved.

??
 
Are you sure the text boxes are in the sstab container? Sorry but someone has to ask the obvious. Ladyhawk. [idea]
** ASP/VB/Java Programmer **
 
That was the first thing I thought, but yea, I move the container and they move with it. Just, when I run the program and it goes through the code to move the boxes around does it do this. ????
 
>>>Just, when I run the program and it goes through the code to move the boxes around does it do this

can you post the code you use? there may be something in there that causes your problem
 
Ok Here the entire procedure I move them around with. One thing though, I just noticed, it only shows the textboxes I move through to the other tab.

Code:
Private Sub MoveInputs()
' Disable Unwanted items
IDno.Visible = False
ADRS2.Visible = False
LocalNo.Visible = False
Email.Visible = False
EmerCont.Visible = False
HghGrdComp.Visible = False
NxtInc.Visible = False
Label1(40).Visible = False
Label1(3).Visible = False
Label1(11).Visible = False
Label1(15).Visible = False
Label1(7).Visible = False
Label1(30).Visible = False
Label1(24).Visible = False
' Rename Items
Label1(27).Caption = "Date Obligated"
Label1(42).Caption = "Pay Prd"
' Move Items around (1st page)
Label1(0).Left = 1950
LN.Left = 2310
Label1(8).Left = 3960
FN.Left = 4320
Label1(9).Left = 5970
MI.Left = 6270
MI.Width = 1665
MI.MaxLength = 25
Label1(4).Top = Label1(4).Top - 300
C.Top = C.Top - 300
Label1(5).Top = Label1(5).Top - 300
S.Top = S.Top - 300
Label1(6).Top = Label1(6).Top - 300
Z.Top = Z.Top - 300
Label1(10).Top = Label1(10).Top - 300
SEX.Top = SEX.Top - 300
Line1.Y1 = Line1.Y1 - 300
Label1(12).Top = Label1(12).Top - 300
PH1.Top = PH1.Top - 300
Label1(13).Top = Label1(13).Top - 300
PAGER.Top = PAGER.Top - 300
Label1(17).Top = Label1(17).Top - 300
PH2.Top = PH2.Top - 300
Label1(14).Top = Label1(14).Top - 300
Cell.Top = Cell.Top - 300
Label1(18).Top = 1230
Label1(18).Left = 5650
Race.Top = 1170
Race.Left = 6150
Vet.Top = 1230
Vet.Left = 7740
Line1.Y1 = 2250
Line1.Y2 = 2250
Line1.X1 = 150
Line1.X2 = 8730
Inact.Top = 1590
Inact.Left = 7740
Label1(16).Top = 1650
Label1(16).Left = 4230
DOB.Top = 1590
DOB.Left = 4740
Label1(22).Top = 2310
Label1(22).Left = 150
NOTEFLG.Top = 2310
NOTEFLG.Left = 1020
Shape1.Top = 2400
Shape1.Left = 120
Shape1.Height = 2055
Notes.Top = 2580
Notes.Left = 180
Notes.Height = 1815
' Move Items around (2nd page)
Shape2.Height = 1335
Label1(31).Top = 870
PRCred.Top = 810
Label1(33).Top = 1170
YTDMkUp.Top = 1140
' Adjust Tab order
SSN.TabIndex = 0
LN.TabIndex = 1
FN.TabIndex = 2
MI.TabIndex = 3
ADRS.TabIndex = 4
C.TabIndex = 5
S.TabIndex = 6
Z.TabIndex = 7
SEX.TabIndex = 8
Race.TabIndex = 9
Vet.TabIndex = 10
PH1.TabIndex = 11
PH2.TabIndex = 12
PAGER.TabIndex = 13
Cell.TabIndex = 14
DOB.TabIndex = 15
Inact.TabIndex = 16
NOTEFLG.TabIndex = 17
Notes.TabIndex = 18
End Sub

I'm going to try to take out the tabindex items and see if that makes the difference.


 
OK I found it!!!!!!!! In my code above where I increase the width of (MI.width), it's the only textbox they wanted me to increase the size of, if I comment that line out, it works correctly.

Pretty strange that, that would cause things poking through the second tab?????

Thanks everyone for help.
 
Sorry bout this, but I found something else, when I commented that line, things were fine, but just for the heck of it, I moved it down a line then uncommented it and everything is OK.

When I moved it back to where it was and uncommented it, it still ran OK. Maybe I've been at this too long, but, it really did happen? Ever have a day like this?
 
The SSTab control that I use needs an SSTabPanel to be drawn on each tab. All controls NOT then placed on the SSTabPanel will show through the SSTab. This is by design, so you can have one control shared between each tab
 
I'm just using the regular SStab that comes with vb, when I draw the sstab, it starts with 3 panels, I've used it dozens of times in many applications and have never experienced the above problems, albeit strange, I think it was just a glitch "it too probably by design :)", anyway the problem disappeared as suddenly as it appeared.

I'm guessing a low memory condition or something like that.

Thanks for your 2 pennies
 
One issue I have had with the process of moving controls on sstab is that if your move places ANY control out of the sstab (container) space, the "focus" move off of the sstab. Following such an event, other activities do not refer to the sstab, but to the object which received focus (usually the parent of the sstab control).

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
dalec,

I was reading on MSDN this morning, about 5 min before reading your post, check this out straight off MSDN VB Tips Page :

::Begin Cut::
Work around the Tabbed Dialog control tab glitch

While not perfect, the Tabbed Dialog control (also known as the SSTab) provides a much needed improvement over the older Tab Strip control. If you're not familiar with this control, unlike it's predecessor, the Tabbed Dialog contains pages upon which you can place controls. These pages act as containers and automatically hide their subordinate controls when you click a new tab. For the most part, the control works without a hitch.

However, if you add an OCX control, such as a Masked Edit or Rich Textbox, to a page, the Tabbed Dialog may exhibit some strange behavior. Normally at runtime, when you press the [Tab] key, Visual Basic tabs between only those subordinate controls on the visible page. If the Tabbed Dialog contains an OCX control, though, it will include this control in the tab order, regardless of whether or not the page hosting the control is visible. Fortunately, there's an easy fix.

Apparently, when a control isn't visible in the Tabbed Dialog, it's because VB has moved it far off to the left of the Tabbed Dialog's left edge. When you select a tab, VB moves the appropriate controls back into Tabbed Dialog's main area. As a result, we can use this behavior to our advantage by testing a control's Left property. If it's greater than zero (visible) then we want VB to tab to it. Otherwise, we want to set the control's TabStop property to false.

The following procedure shows an example of this fix:

Private Sub PreventTab()
Dim ctl As Control
For Each ctl In Me.Controls
With ctl
If TypeOf .Container Is SSTab Then
'Not all controls have the TabStop property
On Error Resume Next
.TabStop = (.Left > 0)
On Error GoTo 0
End If
End With
Next ctl
End Sub
As you can see, this procedure loops through all the controls on the form, testing for those contained in the SSTab (Tabbed Dialog) control. It then sets each control's TabStop property equal to the Boolean result of the expression

.Left > 0
Controls in the visible portion of the SSTab will evaluate to True, while those off the form won't.

::End Cut::

or navigate to:

pc3
 
Thought Id follow up incase someone else has this issue, I ran the code for the SSTAB fix, but, I kept getting an error at

If TypeOf .Container Is SSTab Then

I kinda gave up on that and ended up calling my code that moves the controls to the form_activate procedure, that seems to do the trick (I'm guessing that when the controls are moved right after the form is painted that it then paints or places them correctly).


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top