Results 1 to 21 of 21

Thread: Prevent Mouse from changing caret location in Textbox.

Hybrid View

  1. #1
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,700

    Re: Prevent Mouse from changing caret location in Textbox.

    Set the SelStart property to Len(Text1.Text) before adding more text with SelText.

  2. #2

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819

    Re: Prevent Mouse from changing caret location in Textbox.

    Quote Originally Posted by Eduardo- View Post
    Set the SelStart property to Len(Text1.Text) before adding more text with SelText.
    I can't do that because sometimes the typing starts in the middle.

    For example I'm framing something like this:

    Code:
    *********************************************** ' <- This border
    The Extraordinary Tale of Sterling Soupforkinöv '   <- This is slowtyped in *after* the borders are created.
    *********************************************** ' <- and this border are typed into the textbox first.
    That's just one example. I have stuff like this all over the place. Trying to save the position of every bit of text the program is adding so I can restore the position if the user moves it will be a nightmare.
    Last edited by cafeenman; Dec 20th, 2024 at 03:08 AM.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Prevent Mouse from changing caret location in Textbox.

    Because no one seems to be paying attention...

    Quote Originally Posted by cafeenman View Post
    I can't do that because sometimes the typing starts in the middle.

    For example I'm framing something like this:

    Code:
    *********************************************** ' <- This border
    The Extraordinary Tale of Sterling Soupforkinöv '   <- This is slowtyped in *after* the borders are created.
    *********************************************** ' <- and this border are typed into the textbox first.
    The new text isn't always at the end...



    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: Prevent Mouse from changing caret location in Textbox.

    Quote Originally Posted by techgnome View Post
    The new text isn't always at the end...
    Then, if it's not the user, what's determining where it is?

    And, as I stated before, keep track of your own SelStart, and set it whenever you add new text.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  5. #5
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,700

    Re: Prevent Mouse from changing caret location in Textbox.

    Quote Originally Posted by cafeenman View Post
    That's just one example. I have stuff like this all over the place. Trying to save the position of every bit of text the program is adding so I can restore the position if the user moves it will be a nightmare.
    Then make an UserControl and encapsulate all that functionality in one place.

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