Results 1 to 20 of 20

Thread: Control arrays

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    Hello!
    I've got a problem with control arrays. If I at design-time create a control, such as a textbox and call it Text(0), and then at runtime use Load Text(i), where i = 1, 2, 3 or anything else, the loaded textboxes doesn't show. I can call them, load text into them etc. without error messages, but I can't see them.
    They are not behind Text(0), because when I set
    Text(0).Visible to False the form goes blank, without any textboxes. If I set Text(0).Visible to True again Text(0) appears, but I can't get Text(1), text(2) or anyone else to appear.

    The same thing happens when I tried to load a lot of lines, on slightly different places. The first one appeared, but none of the following.

    What can I do? I have tries the Visible property, SetFocus and other things.
    Please, help me!

    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    You have to set the visible properties of the new text boxes to true. They also load at the same position so try changing the Top property.

    Code:
      Text(1).Visible = True
      Text(1).Top = Text(0).Top + 400
      Text(2).Visible = True
      Text(2).Top = Text(0).Top + 800
    Iain, thats with an i by the way!

  3. #3
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    try this........

    In addition to what Lain said, u can also set the Left property.

    maybe u can use,

    Text(1).Visible = True
    Text(1).Left = Text(0).Left + Text(1).Width
    Text(2).Visible = True
    Text(2).Left = Text(1).Left + Text(2).Width


  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    if you do not set the properties of the new controls at the time of creation, the are an exact replica of the text box array in which they were created by, therefore making them the front text box

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    This is the most common type of thread i've found on this forum: A newbie qwestion and then tons of answers to it. Just because there's noone that really knows what the problem is, but can solve it in their own way.
    If I set Text(0).Visible to True again Text(0) appears, but I can't get Text(1), text(2) or anyone else to appear.
    They appear behind the original, because as David said, they have the same properties as the original. You can use the move method to move the control. Also use Text(text.count-1) instead of text(1) or text(2) if you use your textbox dynamically
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658

    Just for future reference.

    Just for future reference. The name is Iain17. That is an "i" at the start not an "L". Who ever heard of someone called Lain!

    No offence to all the Lain's out there.
    Iain, thats with an i by the way!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    Well, thanks for trying, but I have already tried setting visible property to true, I have moved them around, I have hidden the original text box, and nothing happens.
    I think it's something deeper then the ordinary misstakes.
    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I suggest you shoud post your code, or better than that, the whole form so that we can look at the properties
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145

    Code posted

    OK, here it comes.
    In the form i have a Tabstrip called TabStrip1.
    The textbox (called Text(1)) is of the same size and lies on the tabstrip.
    I have a commandbutton called CmdNew, with which I create new textfiles (and tabs on the tabstrip).

    Code:

    Private Sub CmdNew_Click()
    i = Text.Count
    TabStrip1.Tabs.Add
    Load Text(i + 1)
    End Sub

    Private Sub Form_Load()
    End Sub

    Private Sub TabStrip1_Click() 'Choose what textbox to show
    For i = 1 To TabStrip1.Tabs.Count
    If i = TabStrip1.SelectedItem.Index Then
    'When the choosen number comes up, show that textbox
    Text(i).Visible = True
    Text(i).Text = "Number " & i
    Text(i).SetFocus
    Text(i).Left = 210
    Text(i).Top = 630
    Text(i).Width = 5265
    Text(i).Height = 4740

    Else: 'Hide the not choosen textboxes.
    Text(i).Visible = False
    End If
    Next i

    End Sub


    Please, try it and help me. I' think I'm getting desperate soon...

    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok, and here comes the solution:
    Code:
    Text(i).ZOrder
    put this one in you list of text(i)...
    Also, i suppose you could use with instead of repeating that text(i)

    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145

    Thanks

    Well, I'll try.
    Thanks for helping!

    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  12. #12
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    i have answered this exact question, check out my profile,
    search for other posts by me, and look for something like tab strip or dynamically add

    oh well, i could work it out again if worse comes to worse

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    Well, XOrder helped grat.
    Thanks to you all, I could never find that one out myself!
    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  14. #14
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    what does Xorder do exactly?

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    Oops, sorry!
    It was meant to be ZOrder, with zed.
    It moves controls forwards or backwards on the form.
    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    It's like setwindowpos inside your app
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  17. #17
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    why can't u just use top and left ?

  18. #18
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, david we're talking about having a tablist were the textbox are overlapping each other. With Zorder you can put which one on top or on bottom
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  19. #19
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    ok, sorry,

    how come you get so many replies kedaman?

  20. #20
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    This time, it's because there's people like you are jumping around me
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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