Results 1 to 11 of 11

Thread: SSTab as container?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Cool

    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!

  2. #2
    Guest
    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?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Question

    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)


  4. #4
    Guest
    Try positioning it after you set it's Container.
    Code:
    SSTab1.Tab = 2
    Set Command1.Container = SSTab1
    Command1.Move 0, 0

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Unhappy ???

    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

  6. #6
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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.


  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    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?


  8. #8
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    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


  10. #10
    Guest
    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.

  11. #11
    Guest
    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
  •  



Click Here to Expand Forum to Full Width