Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2009
    Posts
    204

    Unanswered: Problems with setting top property

    Hello,

    I am trying to set the top properties so that when I click a button they move. Basically I am trying to create an expandable list in a form.

    I have tried several different methods with this code, and they all give me the same result: They show the part that I want visible, and for all the top settings, EVERYTHING is moved to the very top.

    How do I get my labels to position where I want them, instead of grouped together at the top of the form?

    Code:
    Private Sub label0_collapse_Click()
    Const pos0 = 0.375
    Const pos1 = 0.6667
    Const pos2 = 0.9583
    Const pos3 = 1.25
    Const pos4 = 1.5417
    Const pos5 = 1.8333
    Const pos6 = 2.125
    
    Me.Label0caption.Visible = False
    Me.label0_hyperlink.Visible = False
    Me.label0_expand.Visible = True
    Me.label0_expand.SetFocus
    Me.label0_collapse.Visible = False
    Me.Label0title.Top = pos0
    Me.label0_expand.Top = pos0
    Me.Label1title.Top = pos1
    Me.label1_expand.Top = pos1
    Me.Label2title.Top = pos2
    Me.label2_expand.Top = pos2
    Me.Label3title.Top = pos3
    Me.label3_expand.Top = pos3
    Me.Label4title.Top = pos4
    Me.label4_expand.Top = pos4
    Me.Label5title.Top = pos5
    Me.label5_expand.Top = pos5
    Me.Label6title.Top = pos6
    Me.label6_expand.Top = pos6
    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    They do not move to the top, but close to!. You have to specify the position of a control on a form in Twips, not in inches or in centimetres. 1440 twips = 1 inch, 567 twips = 1 cm.
    Have a nice day!

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Argh! The dreaded twip! Seeing the number of twips in code does nothing for me. So what I do is add "* 1440" to a number so I can see how many inches it is. In your case I would change your constants to:

    Code:
    Const pos0 = 0.375 * 1440
    Const pos1 = 0.6667 * 1440
    Const pos2 = 0.9583 * 1440
    Const pos3 = 1.25 * 1440
    Const pos4 = 1.5417 * 1440
    Const pos5 = 1.8333 * 1440
    Const pos6 = 2.125 * 1440
    It is totally personal preference, but I think it is easier to read (self documenting code).

  4. #4
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by DCKunkle View Post
    Argh! The dreaded twip! Seeing the number of twips in code does nothing for me. So what I do is add "* 1440" to a number so I can see how many inches it is. In your case I would change your constants to:

    Code:
    Const pos0 = 0.375 * 1440
    Const pos1 = 0.6667 * 1440
    Const pos2 = 0.9583 * 1440
    Const pos3 = 1.25 * 1440
    Const pos4 = 1.5417 * 1440
    Const pos5 = 1.8333 * 1440
    Const pos6 = 2.125 * 1440
    It is totally personal preference, but I think it is easier to read (self documenting code).

    Thanks, I'll try this. I read a little about twips, but I thought that the properties tab in design mode would show the number in twips, not inches...

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    forget the details but in vb & vb.net yiou had to add the height of the menu &/or caption as well. this may also apply to Access forms
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •