Solved

Memo.Lines.add ... Easy Points...

Posted on 1998-02-27
5
997 Views
Last Modified: 2011-04-14
Hi,
     I need to add text to a memo, but not at the end of
the file. Can anyone tell me how to do this whereby the
text is added at the cursor? I'm sure it's not hard, but
I can't work it out. It's v. important as it's my final
year project! Please Help! Thanks in advance...
0
Comment
Question by:NikWhit
  • 2
  • 2
5 Comments
 

Expert Comment

by:puppy
Comment Utility
what you need to do in the project?
0
 
LVL 4

Accepted Solution

by:
itamar earned 20 total points
Comment Utility
Hi Nik,

this piece of code will insert a text at the cursor position:

  RichEdit1.SelText := 'Text inserted';

Any doubts, place a comment.

IHTH,
Itamar
0
 
LVL 1

Author Comment

by:NikWhit
Comment Utility
Itamar,
    That seems to work fine, thanks! Just one other thing :
is it possible to move the cursor to another position? e.g. if
I wanted to insert the text '\chapter{}' and then leave the
cursor between the curly braces, so the user could insert a
name, how would I do that?
    Thanks... Nik.

0
 
LVL 4

Expert Comment

by:itamar
Comment Utility
Humm, another question and still 10 points ??? P(

Ok, in this specific case do this:

      with RichEdit1 do begin
            SelText := '\chapter{}';
            SetFocus;
            SelStart := RichEdit1.SelStart - 1;
      end;

As the cursor will be positioned at the end of the inserted text, subtracting 1 makes the cursor skips (backwards) the last curly brace.

Bye,
Itamar

P.S.: I'd be gratefull if you could increase some points before grading the answer !
0
 
LVL 1

Author Comment

by:NikWhit
Comment Utility
Adjusted points to 20
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now