Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    tab stop label user form (Word XP)

    I think this makes sense.
    I can't set a tab Stop on a label in a user form.

    As my user builds a filename, I display it in a label. I have a double-click event on that label that copies the label contents (the embryonic file name) into the clipboard.
    It made sense to me to permit the user to tab to that label and then hit "Enter" to achieve the same goal, but tab stops default to False at run time.

    I can tab to a command button and use "Enter".

    The command button has an Enter event, whereas a label does not.
    A minor annoyance.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: tab stop label user form (Word XP)

    A label is just supposed to be a label for something else... Try using a TextBox with a "flat" style and, if necessary, disable editing.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: tab stop label user form (Word XP)

    TabStop shouldn't be in the list of properties of a label - if you look up TabStop in the online help, Label isn't among the controls it applies to. Why don't you use a command button? You can set the caption of the command button in code.

    Note: the Enter event has nothing to do with the Enter key. The Enter event occurs when a control gets the focus.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: tab stop label user form (Word XP)

    The label has no enter event because labels can't receive the focus. They have a click event, but you can't tab to a label ... unless you go to .Net, of course. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: tab stop label user form (Word XP)

    > Why don't you use a command button?

    You'e right. I chose a label initially because I was making a "status display", as in "Here is where we are up to in building your new name". Then we decided it would be nice to be able to copy it to the clipboard. Hence the DClick event.

    I now think it odd that both Labels and Command Buttons can have Click and DClick events, but only one can have an Enter event.


    > The Enter event occurs when a control gets the focus.
    You're right. My mistake for thinking that Microsoft would use a word consistently. (Grin) "Enter" here is more the sense of 'Entry" than "the CR/LF key with ENTER printed on it"

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: tab stop label user form (Word XP)

    > Try using a TextBox with a "flat" style and, if necessary, disable editing.

    Thanks Jefferson, this almost works. I tried a Command Button but there my text is centered, here it is left-aligned, as I like it. However i can'r DClick it if it is enabled, nor can the user tab-end-hit-enter, I'll play around a bit more.

  7. #7
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: tab stop label user form (Word XP)

    Another possible approach, if you're still playing around:

    You can put a transparent command button on top of the label. Its Visible property should be True, but set its Transparent property to Yes.

    Use the GotFocus and LostFocus events of the button to toggle the BackStyle of the label from 1 (normal) to 0 (transparent) as a visual indicator that the user has tabbed to the label and that hitting the Enter key will copy its contents to the clipboard.

    Put your code for copying to the clipboard in the DblClick event of the button so double-clicking on the label (really on the button) will run the code.

    Finally, put the following code in the KeyDown event of the button to have the button respond to the Enter key by running the same code:
    <pre> If KeyCode = vbKeyReturn Then
    Call cmdInvisible_DblClick(True)
    KeyCode = 0
    End If</pre>


  8. #8
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: tab stop label user form (Word XP)

    <hr>You can put a transparent command button on top of the label.<hr>
    Great idea! <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

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