Recent

Author Topic: How to clear a TMemo out of lines?  (Read 28021 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
How to clear a TMemo out of lines?
« on: September 07, 2011, 03:42:48 am »
Good people:

I have the Memo1 with a few lines, how to clear it to zero lines?

I tried lines.count := 0; but that did not work.

Then after I clear it, how to put just one line into it, for example: 'This is line1'.

And also, where can I find documentation on how to use these methods? that start with a .dotMethod for TMemos, and just as well for other type of objects?

Thanks!

meulinux

  • Guest
Re: How to clear a TMemo out of lines?
« Reply #1 on: September 07, 2011, 04:20:58 am »
Memo1.Lines.Clear;

 ::)

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How to clear a TMemo out of lines?
« Reply #2 on: September 07, 2011, 05:24:12 am »
Memo1.Lines.Clear;

 ::)

Great help, meulinux.
That's a powerful statement.

Now, if you don't mind, where can I learn things like that (part of my original question).

Thanks!

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: How to clear a TMemo out of lines?
« Reply #3 on: September 07, 2011, 07:04:31 am »
And also, where can I find documentation on how to use these methods? that start with a .dotMethod for TMemos, and just as well for other type of objects?

In google, I just typed "lazarus TMemo" without quotes and the first link was the reference documentation:

http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html

And then you can click on links there are find the reference for TMemo.Lines:
http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcustommemo.lines.html
Then click on TStrings:
http://lazarus-ccr.sourceforge.net/docs/rtl/classes/tstrings.html

Where you can read:

  procedure Clear; virtual; abstract;   Removes all strings and associated objects from the list.

There are also links to docs here: http://wiki.lazarus.freepascal.org/LCL_Components
One other thing, please try to keep questions about the LCL in the LCL sub-forum =) thanks

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to clear a TMemo out of lines?
« Reply #4 on: September 07, 2011, 08:06:11 am »
Now, if you don't mind, where can I learn things like that (part of my original question).

See this post - and the next for sources of information on FreePascal, Delphi (handy, as Lazarus is almost always compatible), and Lazarus:
http://lazarus.freepascal.org/index.php/topic,13951.msg73534.html#msg73534

Don't know if I mentioned it there, but Delphi online documentation can help, too:
http://docwiki.embarcadero.com/RADStudio/en/Main_Page, especially the pages under Delphi Reference

Hope this helps,

BigChimp
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How to clear a TMemo out of lines?
« Reply #5 on: September 07, 2011, 08:18:23 am »
Thank you good people,

Please don't think I don't try to find the info before I ask, but the Lazarus Ocean is immense (to me a beginner).

The .dot methods of components is where I wish there were a compendium, or some book just explaining that.

They are the most powerful commands, in a way, specially if one does not know about them much effort has to be afforded.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: How to clear a TMemo out of lines?
« Reply #6 on: September 07, 2011, 09:35:02 am »
The .dot methods of components is where I wish there were a compendium, or some book just explaining that.

There is a book: http://www.blaisepascal.eu/index.php?actie=./subscribers/lazarusbookinfoEnglish

And also the online reference: http://lazarus-ccr.sourceforge.net/docs/lcl

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: How to clear a TMemo out of lines?
« Reply #7 on: September 07, 2011, 11:05:57 am »
Most of the guides are written for Delphi, and they most of the time work for Lazarus too. Google can easily find example codes for delphi problems.

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How to clear a TMemo out of lines?
« Reply #8 on: September 07, 2011, 10:59:27 pm »
Thanks, User 137.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11926
  • Debugger - SynEdit - and more
    • wiki
Re: How to clear a TMemo out of lines?
« Reply #9 on: September 08, 2011, 01:22:38 am »
About learning, there are many methods. Google certainly is one, and a good one at that.

Another code way (at least for me) is to simply explore.
In Lazarus the IDE helps you with code completion.

Type Memo1. and ctrl-space, and you see all the methods, finctions, properties.
For memo1, you will find:
  Text
  Lines
  Append
  Clear
  SelectAll
You can find them by scrolling through the list, or with growing knowledge and experience, you will have a hunch to look for certain word (start typing them).

At this time it will of course be useful, if you know basic pascal. The IDE shows you that "Clear" is a procedure, but "Lines"a property (of type TStrings). So you know that you can search for more under lines.

The same way you will find that Memo1.Lines.Count is a function, and can not be assigned....

Best of all, all the source is there, so you can even jump to a method, and see what t does, or in case of a property, jump to it's declaration, and then jump to the declaration of TStrings.

---
Btw, not directly related, but if you have not yet read the following page, read it:
http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How to clear a TMemo out of lines?
« Reply #10 on: September 08, 2011, 02:54:58 am »
About learning, there are many methods. Google certainly is one, and a good one at that.

Another code way (at least for me) is to simply explore.
In Lazarus the IDE helps you with code completion.

Type Memo1. and ctrl-space, and you see all the methods, finctions, properties.
For memo1, you will find:
  Text
  Lines
  Append
  Clear
  SelectAll
You can find them by scrolling through the list, or with growing knowledge and experience, you will have a hunch to look for certain word (start typing them).

At this time it will of course be useful, if you know basic pascal. The IDE shows you that "Clear" is a procedure, but "Lines"a property (of type TStrings). So you know that you can search for more under lines.

The same way you will find that Memo1.Lines.Count is a function, and can not be assigned....

Best of all, all the source is there, so you can even jump to a method, and see what t does, or in case of a property, jump to it's declaration, and then jump to the declaration of TStrings.

---
Btw, not directly related, but if you have not yet read the following page, read it:
http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools

Thank you, Martin!

I've heard about this, but your explanation is excellent and I will start trying it shortly.

I do investigate a lot on the web. Have already hundreds of links in folders and subfolders. I even got a book from Marco Cantu on Delphi-7 but he jumps all over me.

There's nothing like need that motivates the learning, that's why I have a major project going on for quite a while, and has been the basis of most questions you all great people have helped me with. 8)

 

TinyPortal © 2005-2018