|
-
Aug 13th, 2000, 03:46 AM
#1
Thread Starter
Hyperactive Member
I have to dynamically put a label into a SSTab, how can I put it into second Tab?
I tried
SSTab.Tab = 1: Set Label1.Container = SSTab
but it do not work, it still puts it into the first tab
Besides, if I check a label's container property, I can
tell that it is in a SSTab, but how can I know what is the
.Tab property (page) that really hold this label?
Thanks a lot for any hint!
-
Aug 13th, 2000, 05:18 AM
#2
this works perfectly for me...
Code:
SSTab1.Tab = 2
Set Label1.Container = SSTab1
it always puts the label in the third tab, perhaps it is a bug that was fixed in one of the service pack issues. what version of Vb/service packs are you using?
-
Aug 13th, 2000, 05:28 AM
#3
Thread Starter
Hyperactive Member
I am using VB5 SP3. I copied exactly your code and test, it still not working. Maybe you are right about the version
My Tabctl32.ocx version is 5.01.4319
Besides, how can I read the tab number for a control that is inside the SSTab (say, on the second tab page)
-
Aug 13th, 2000, 08:47 AM
#4
Try positioning it after you set it's Container.
Code:
SSTab1.Tab = 2
Set Command1.Container = SSTab1
Command1.Move 0, 0
-
Aug 13th, 2000, 09:29 PM
#5
Thread Starter
Hyperactive Member
???
I tried several ways, and I found the sequence:
(Megatron, your suggestion get the same result)
if I set the container in form_load, it will not work.
if I put it in a command button and manual press the button, it works
if I call Command1_Click inside Form_Load, it do not work (disregard whether I put DoEvents in between)
if I set the form to KeyPreview and SendKeys inside Form_Load, and then inside Form_KeyPress set the Container, then it works.
Do you have any suggestions?
Besides, would you tell me about the second question, i.e. how can I know which tab page it is that a control is placed.
Thanks
-
Aug 13th, 2000, 09:36 PM
#6
Frenzied Member
you won't be able to do it in the Form_Load event, it's because the container properties are all set after the form_Load, the best thing to do would be to have a timer on your form with interval set to 1. some of the Form_load code in there, (the bit that sets the container) and then end the timer event with Timer1.Enables = false so that the timer doesn't fire again.
-
Aug 14th, 2000, 02:15 AM
#7
Thread Starter
Hyperactive Member
Thanks a lot, using the timer (actually, similar workaround) it is working now.
Now the set problem is solved, could anybody help me in solving the read problem?
-
Aug 14th, 2000, 02:39 AM
#8
Frenzied Member
I think you're gonna have to keep track of the controls yourself, wen you set the container property the control is placed in the currently active tab, have a collection for each tab and add controls to the relevent collection every time you put them in. then loop through all these collections to see which one you're control's in to check if 2 variables hold instaced of the smae object use something like
Code:
If ObjPtr(Control1) = ObjPtr(control2) Then
'Code here if they are equal
End If
unless you use the Tabstrip control, in wich you have to do a lot more yourself, you won't be able to tell which tab what control is in.
-
Aug 14th, 2000, 03:12 AM
#9
Thread Starter
Hyperactive Member
Thank you Sam,
I found a workaround, but I don't know how long will it be valid.
When you view SSTab, Tab = 0, then all the control in this tab will have .TabStop = True,
and those control in Tab = 1 will have .TabStop = False
I am trying to use this to identify the tab number.
Thanks a lot for help from all of you
-
Aug 14th, 2000, 12:52 PM
#10
i have found that putting
Form1.Show
actually in the form_load event, then it solves many problems of this type, try that before anything else.
-
Aug 14th, 2000, 01:17 PM
#11
Placing it in the Load() event seems to work for me.
Code:
Private Sub Form_Load()
Set Label1.Container = SSTab1
Label1.Move 0, 0
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|