Jump to content
James Hellums

Trying to learn Lazarus

Recommended Posts

Please be kind! Lol. I am trying to learn Lazarus. I am using ver 2.01. 

I have searched Google for my answer, but it's always about strings to a listfilebox. I just want to know how to ADD text file contents to a memobox. My program lets the user select a txt file and it shows the content. They can open multiple text files and save them all as .mtf files. I just need an example or code to show me. I tried memobox1.add.lines(Openfromfile) with error. Help! Thank you.

Share this post


Link to post
12 hours ago, James Hellums said:

I just want to know how to ADD text file contents to a memobox.

FreePascal/Lazarus's RTL/LCL frameworks are fairly API-equivalent to Delphi's RTL/VCL, about on par with Delphi 7-ish, with a few 2009+ features thrown in (UnicodeString, etc).  So, if you have something already working in VCL, it will likely port as-is (or close to it) to Lazarus.

Edited by Remy Lebeau

Share this post


Link to post

hey Traum!

I added memobox1.lines.loadfromfile(OpenDialog1.FileName); after if OpenDialog1.execute then begin and still got an error! My program will load a text file, but it won't let me append. it always replaces the file. got the program to run, but it still will only accept 1 file. it still replaces the file rather than appending. 

If I ever figure this out with someone's help, I will never forget it! I have been searching for this solution for 2 months. Guess the default is to replace. So I need to over ride that! But how? 

Edited by James Hellums
g

Share this post


Link to post

Had to rem the memobox1.lines(loadfromfile) to get the exe.

Here's what I have so far. When clicking on open text file, it displays the text file contents. When I click again, I want to add a hyphenated line as a divider. It does that. If the user does not choose a file, a showmessage alerts them that they did not choose a text or multi file. But when i click on open text file, the new one replacing the old one. I need to be able to add up to 150 more text files. I  have open and save working for the text and multi files with showmessages. Just can't get the files to append.

Thanks, Traum!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×