Memo field stopped refreshing after 12K entries. lazarus / 31-LCL ---------------------------------------------------------------------- Gizmo · 2012-04-20 10:56 Hi I've got a program with a Memo field in it. The memo field is updated with string values in loops. I thought it was fine and stable until today when I used it for quite large task (as in a task that mean tens of thousands of entries in the memo field). Basically, it got to about 12K lines, and then stopped refreshing. The program is still running and I can tell by output elsewhere that it is still doing its job, but the memo field has just stopped responding? Any ideas? ---------------------------------------------------------------------- KpjComp · 2012-04-20 13:18 Hi Ted, I think I've mentioned this before, a Tmemo really isn't the best option when you want thousands of lines. For a start it's constantly using string expansion every time you do a lines.add. Try using some of these ->  TListBox, TStringGrid, TSynEdit. The above will be using pointers for each line, rather than manipulating a massive string. ---------------------------------------------------------------------- Blaazen · 2012-04-20 18:22 Adding 100 000 lines to TMemo takes ~40s and only ~10s to TListBox here (2GHz). ---------------------------------------------------------------------- KpjComp · 2012-04-20 18:48 Quote from: Blaazen on April 20, 2012, 08:22:14 pmAdding 100 000 lines to TMemo takes ~40s and only ~10s to TListBox here (2GHz). Use listbox1.items.beginupdate / endupdate you should get even faster.  eg. on my ageing Q6600 about 3 seconds. The fastest lists are those you can also virtualize, eg. if you've ever used TVirtualTree, basically you can add thousands of lines in milliseconds. Actually in my install there is a TVirtualList, and that's instant without even vitalizing the data. ---------------------------------------------------------------------- Gizmo · 2012-04-23 13:26 OK, thanks guys. I'll make some changes using ListBox instead and report back. Out of interest, the memo did eventually refresh after the processes had completed as opposed to after each loop, which it did for the first few thousand entries. Quote odd that it just stopped and then completed at the end, but hey. ---------------------------------------------------------------------- Gizmo · 2012-04-23 22:18 I've swapped my Memo to a ListBox and it does work better (except it doesn't auto-refresh at all - maybe I need to add Application.ProcessMessages?). Thanks gents. Quick question - I notice it has a columns property. I'd like to split my entries into columns. Though it sounds ideal to use a StringGrid, this portion of my program dsiplay various output depending on various checkboxes so it's easier to leave it as a ListBox. Given that, how can I split my content into columns? I have set the property to 4 as there are 4 columns of data I'd like to display. In this link (http://delphi.about.com/cs/adptips2000/a/bltip1200_3.htm), for example, it states that with Delphi you simply add ^I between each part, but that doesn't work with Lazarus? I have this so far: Code: [Select] ListBox1.Items.BeginUpdate; ListBox1.Items.Add('Blah Blah : ' + StringVarA + '. String B and C together : ' + StringVarB + StringVarC + '. String D Is : ' + StringVarD); ListBox1.Items.EndUpdate;  Thanks (Have read many links, like http://62.166.198.202/view.php?id=445 , http://wiki.freepascal.org/Grids_Reference_Page, http://www.daniweb.com/software-development/visual- basic-4-5-6/threads/53725/how-do-i-populate-multiple-column-list-box and ---------------------------------------------------------------------- Pascaluvr · 2012-04-24 01:48 If I understand you correctly, Listbox wont do what you want. Multicolumn simply lists each item in column 1 until it fills up, then continues from the top of column 2 until it fills... etc.  when all columns are full and more items are added, a scrollbar is added.  (You have probably seen some file dialogs that work this way). A stringGrid is probably what you are after.