Requests for conceptual help with unusual data-aware TMemo or TRichMemo lazarus / 31-LCL ---------------------------------------------------------------------- jdlinke ยท 2014-06-25 19:11 I need some assistance with finding the best approach to reaching my goal of displaying record content from a query in a memo or richmemo. The end-state is a logbook kind of display that is read-only but allows text to be selected (and highlighted if I go with RichMemo) What I'm doing now: When running a query, each record is formatted as strings and added to the memo (First line has the record date and some header info, remaining lines have a bunch of text, and the length/linecount will vary for each record). It currently works and looks great - for the tiny database I have so far. Once I get over a certain number of records, though, I'm going to run into potential problems with memory as I fill a TMemo with perhaps millions of lines of text from the entire query/database. What I want to do, and how I'm currently considering approaching this: I want to make my Memo data-aware so that I'm only displaying the number of records currently in my dataset's buffer. For the most part I don't think this will be a problem. I should be able to keep track (using an array or a list of some sort) of the number of lines each record is taking up in my memo, and add/subtract these lines as I navigate through a dataset. My problem: Because each record has a different number of lines (anywhere from 2 lines to 100 or so), I can't approach this like one would with a grid where the cell height is contant for each record. So I guess I need to implement some custom scrolling. I considered using the record count from my query results for this purpose, but again, since each record will take up a different amount of vertical space in my memo, this simple approach doesn't seem like it will work well. My scrolling would end up jumping over parts of some records, I think. Any of you have any recommendations for how I might be able to solve this? Should I be approaching this differently? Thanks for any guidance you can provide. - Jack