Solved

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

Posted on 1998-02-27
5
1,005 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Expert Comment

by:puppy
ID: 1359883
what you need to do in the project?
0
 
LVL 4

Accepted Solution

by:
itamar earned 20 total points
ID: 1359884
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
ID: 1359885
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
ID: 1359886
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
ID: 1359887
Adjusted points to 20
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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