[Lazarus] In search of a component for holding a table of strings

Bart bartjunk64 at gmail.com
Fri Jan 6 13:40:01 CET 2017


On 1/6/17, Michael Schnell via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> Looking at the code I could imagine that auto-growing when using the
> Cell property to write an element might be appropriate.

I thought bout that, but rejected it.

> Read/Write form/to a file might be sensible. Here AFAIK, the fpc's
> TStringList does not yet feature setting the encoding, which Delphi does.

And then we get the problem of the format of the file.
We had similar discussion about TStringGrid (which supports .csv
files), I think with BigChimp (Reinier).
Any choice you make here is arbitrary.

Options:
- class helper
- a system like TBufDataSet uses: implement SaveToStream and
ReadFromStream that require a reader/write class
- make a new unit that implements reader/writer procedures
(StringTableExportToCSV(const Fn: String; ST: TStringTable) etc.

My current usecase does not require this at all.
I use it for string the contenst of a HTML table (copied from
clipboard) and extract data from that.

(Starts ranting)

All this because the manufacturor of the pogram refuses to implement a
simple function: give me a list of current medication in a simple
plain text format.

While the program (a web application) can show on the screen stuf like:

metoprolol mga 100 mg 1 maal daags 1 tablet (oraal)
clopidogrel 75 mg 1 maal daags 1 tablet (oraal)

It is impossible to copy and paste this in any other program without
much editing.
E.gif you copy/paste 10 lines like this in MS Word (or Notepad for
that matter), you end up with a document of 80 pages (!!!!!), mostly
whitespace (LineEndings, space, non-breaking-space) and the text gets
cluttered with opening and closing brackets and bullets.

The web program also can show this information as a HTML table, but
again copy/pasting this ruins your Word document.

So that's where my program comes in.
It can deal with the table and with the other (plain text) format, and
it santizes the input.
It will change
"metoprolol mga 100 mg 1 maal daags 1 tablet (oraal)"
into
"metoprolol mga 100 mg 1 dd 1"

It will also deal with the fact that MS Word has decided to treat
LineEndings as New Paragraph.

And all this is necessary so that I can copy/paste current medication
into letter of referral or letter of discharge (instead of manually
typing it, with the risk of potentially devestating typo's..
And each and every update of the webprogram they change something
about the layout or separators they use, and I have to update my
program again.

Mind you FF is able to copy the table in plaintext format using Tabs
as a separator, which would be easy, but IE (which is the only browser
available to me on the system) cannot do so.

Obviously my boss does not care, he does not have to use this program,
only the doctors (12 of them) have.
And needless to say that the ICT department has forbidden me to use
this program, because "it is not a commercial progra, and therefore
there is no offical support for it, and unsupported programs cannot be
installed on our system".
(Note: the ICT guys all use Chrome as their browser, because "IE sucks")
Fortunately my program is standalone (try that with VB or VC), so I
just put it somewhere on a share, and so far they have not noticed.

Bart


More information about the Lazarus mailing list