Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Cursor position in Input Mask (XP)

    Hi all,

    I have an input mask in a control on a form. When I click in the control, the input mask affects the position of the cursor. Sometimes its at the end of the input mask and sometimes in the middle. I would like to click anywhere in the control and the cursor must position in the beginning so I can start typing. Any ideas how to get this right? If there is no default setting, then maybe a macro on the on_enter event??

    Any help is appreciated
    Tx
    Regards,
    Rudi

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Cursor position in Input Mask (XP)

    This code puts the cursor back at the start of the text box.

    Me.HomePhone.SelStart = 0
    Me.HomePhone.SelLength = 0

    In my testing, this worked in either the onenter event or on gotfocus event, for tabbing into the field, but to get it to work for a mouse click, I needed to also put it in the onclick event.
    Regards
    John



  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Cursor position in Input Mask (XP)

    Does that work when you have entered a value and you click back in the control?

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Cursor position in Input Mask (XP)

    It does not make any difference if there is some text in the control.

    Do you want it to be different?
    Regards
    John



  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Cursor position in Input Mask (XP)

    So it clears the contents of the control?

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Cursor position in Input Mask (XP)

    No, it just puts the cursor at the start.
    Regards
    John



  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Cursor position in Input Mask (XP)

    Thanks John, it was for interest only.

  8. #8
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Cursor position in Input Mask (XP)

    Great...much obliged!
    It seems the only way to do this then is by event code.

    Tx a stack!
    Regards,
    Rudi

Posting Permissions

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