×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Position cursor at specific position in a memo field

Position cursor at specific position in a memo field

Position cursor at specific position in a memo field

(OP)
I have a memo field that already contains data. I have a simple form that has a editbox controlsourced to a memo field. I want to add a line at the beginning to the existing data in the memo field and have the cursor (in the editbox) positioned at the end of that new line I added to the beginning of the existing memo. The line I add to the beginning at the memo is something that looks like this:
05-01-2018 Bill Totten:

I want the cursor to be at the end of line next to the ":".

I can add the new line to the existing memo data and put the cursor at the end of the line I added. The problem is when I want to add the new line to the beginning of the existing memo data.

Bill

RE: Position cursor at specific position in a memo field

Morning, you seem to be looking to pop a new text line on a memo (in an edit box?) and position the cursor at the end of that line?
People quite often do things like this on ERM systems - using a button on a form to add a comment with a time, date and user name to a memo

The key is the selstart and sellength properties of the editbox.

If you were using a button to do this, the Click event code might look like:

CODE

local lcNewLine
lcNewLine = DTOC(Date())+" "+time()+" "+gcCurrentUser+": "
thisform.CommentsBox.Value = lcNewLine+chr(13)+chr(10)+thisform.CommentsBox.Value
thisform.CommentsBox.SelStart = Len(lcNewLine)
thisform.CommentsBox.SelLength = 0
thisform.CommentsBox.Setfocus() 

If your data is bound to the edit box, the underling memo should be updated, otherwise, you could pop the update into the controls 'lostfocus' event.


Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close