[fpc-pascal] How to customize a TDBMemo

Joost van der Sluis joost at cnoc.nl
Mon Sep 8 22:48:41 CEST 2008

Op zaterdag 06-09-2008 om 20:35 uur [tijdzone -0300], schreef Felipe
Monteiro de Carvalho:
> Hello,
> I am using a TDBMemo with a TSdfDataset, but this database uses
> newlines to separate the records, so it's impossible to store data
> with multiple lines.
> So I thougth that I could do a trick, and process the data before
> showing in the TDBMemo and also before sending it again to the
> database. I would store newlines as a special character, say # in the
> database and then convert them to new lines to show in the TDBMemo.
> How can this be achieved?

Did you try to assign a method to the right TField.OnGetText? There you
could handle this.

> Do I really need to create a completely new component or is there some
> strategy to customize the existing TDBMemo?

What you're trying to do should work with TSdfDataset, but TMemDS is
somewhat more stable, I would guess. Why don't you use that one?

Or, if you're using trunk, you could use TBufDataset stand-alone. This
is only brand-new, so you could find some bugs on the way. Good news
offcourse is, is that I;m busy with it, so there's a chance it will be
fixed soon. ;)


More information about the fpc-pascal mailing list