ecastle
asked on
Delphi Programming question
Hi,
I want to copy the text selected in one memo (memo1 on form2) and paste it into another memo1 (on form1) using a button on form2. I only want the text to be added to the memo on form1, not replace the text currently in there. How would I do that? I can email you the program if you want.
Thanks for your help.
I want to copy the text selected in one memo (memo1 on form2) and paste it into another memo1 (on form1) using a button on form2. I only want the text to be added to the memo on form1, not replace the text currently in there. How would I do that? I can email you the program if you want.
Thanks for your help.
ASKER
I'm not sure I understand. I gave you the name and places of all the components, so if you give me exactly the code to use you can have 100 points :)
ASKER
I've worked it out now with the help of people on IRC. Thanks anyway Ian, but your answer was no help :P
this is an example with 2 memos on the same form, it is suppossed to work also with different forms:
procedure TForm1.Button1Click(Sender : TObject);
begin
memo1.copytoclipboard;
memo2.setfocus;
memo2.pastefromclipboard;
end;
procedure TForm1.Button1Click(Sender
begin
memo1.copytoclipboard;
memo2.setfocus;
memo2.pastefromclipboard;
end;
ASKER
As I said, I have solved it. My problem was that I had to include the unit call in a second 'uses' after 'implementation', instead of the one at the top of the source.
I have absolutely no comments.
You must to include the second unit in the implementation uses clause to have access to its objects.
If you are done with this question accept an answer and quit.
If you are done with this question accept an answer and quit.
ASKER
Isn't there a way to cancel my question? I worked it out with the help of someone on irc. Nobody here provided me with a satisfactory answer. Why should I pay the points?
The question was not well formulated. The problem you described make people think about especific methods of TMemo and so on. I advise you to learn the basics of Delphi programming (or anything else) before submiting your questions in a expertise site. You have the news and chats to go. At least you can remove your question following the instructions on:
https://www.experts-exchange.com/info/DelQuestion.htm
https://www.experts-exchange.com/info/DelQuestion.htm
ASKER
When you are learning something as complex as Delphi with just the program and no documentation or tutorials to help you it's hard to know everything... sorry I'm not as skilled as you.
No documentation?? Are you using a illegal copy of Delphi??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
MemoTarget.Lines.AddString
The lines of a memo are of type TStrings, so you can work with the properties and methods of TStrings. You also can use SelText etc. as they are in the Memo's ancestry.
Cheers,
Ian C.