Re: [Lazarus] In search of a component for holding a table of strings
On 1/6/17, Michael Schnell via Lazaruswrote: >> Just implemented sorting. > Nice ! > (Even if I don't see a straight forward understanding of two dimensional > sorting). Imagine you wat the rows that have the largest values (this depends on the context) at the top, or likewise columns at the left? Sorting individual rows/cols o.t.o.h. makes no sense to me. Anyhow: implementing sorting was just an excercise to see if it would work. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 1/6/17, Michael Schnell via Lazaruswrote: > Instead of a two dimensional array of strings you could have use a > single dimensional array of StringLists (a less symmetrical way, of > course). That was my frist try (see: http://svn.code.sf.net/p/flyingsheep/code/trunk/FarmedTools/tableemulator.pp), but then you run into troubles when a string contains a LineEnding... Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 06/01/17 16:46, Michael Schnell via Lazarus wrote: > On 06.01.2017 16:20, Bart via Lazarus wrote: >> That makes no sense to me, > Instead of a two dimensional array of strings you could have use a single > dimensional array of StringLists (a less symmetrical way, of course). > > -Michael Yeah basically access every row or col as a TStrings type (for easy .Delimited or .CommaText yield) -L. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 06.01.2017 16:20, Bart via Lazarus wrote: That makes no sense to me, Instead of a two dimensional array of strings you could have use a single dimensional array of StringLists (a less symmetrical way, of course). -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On Fri, January 6, 2017 5:40 am, Bart via Lazarus wrote: > 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. > If you get into some tricky web browser issues you can also visit the DOM with internet explorer embedded browser control.. (or firefox embedded or chromium embedded). Then you can copy whatever html table you want into whatever format you want... just visit the table via the dom, or visit any of the html web page components and deal with it. But if fast html parser does the job... it's simpler. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 1/6/17, Lukasz Sokol via Lazaruswrote: > OK I understand, you don't want to depend on TStrings ? That makes no sense to me, some methods take a TStrings as parameter... Maybe you meant TStringGrid instead? I did not want my code to depend on LCL. (It does depend on LazUtils though, but that can be stripped out easily for anyone who cares). Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 1/6/17, Michael Schnell via Lazaruswrote: > 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 -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 1/6/17, Lukasz Sokol via Lazaruswrote: > just having a look at the declaration, haven't skimmed through code yet, > > do you also plan to add a TStringGrid-like interface for cols and rows No, I wanted to keep it as simple as possible. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] In search of a component for holding a table of strings
On 05.01.2017 18:10, Bart via Lazarus wrote: Just implemented sorting. Nice ! (Even if I don't see a straight forward understanding of two dimensional sorting). BTW.: Looking at the code I could imagine that auto-growing when using the Cell property to write an element might be appropriate. 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. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus