Solved

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

Posted on 1998-02-27
5
1,006 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

624 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