Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-09

How to customize a TDBMemo

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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?

I could not find events which would allow me to do this, so I tryed to create a TDBMemo descendent and override some method, but this also doesn't work, because I would need to access private fields in TDBMemo (specially FDataLink).

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

thanks,

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
I could not find events which would allow me to do this, so I tryed to create a TDBMemo descendent and override some method, but this also doesn't work, because I would need to access private fields in TDBMemo (specially FDataLink).

I got no idea if this will work, but wouldn't it be possible to override the LoadMemo() method. I see they already to some testing before displaying values for Blob fields. This might point you in te right direction.

[advertising hat on]
Otherwise, leave DB-aware components completely and instead use an Object Persistent Framework like tiOPF and Model-GUI-Mediator (MGM is also part of tiOFF) to make standard controls "object-aware" without creating descendants. ;-)
With Michael van Canneyt's awesome Lazarus Data Desktop and refactoring changes in MGM, you can now put together a database application just as quick if not quicker with tiOPF and standard GUI components.
[advertising hat off]

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Joost van der Sluis
to Felipe Monteiro de Carvalho: I am using a TDBMemo with a TSdfDataset, but this database uses newlines to separate the…

Op zaterdag 06-09-2008 om 20:35 uur [tijdzone -0300], schreef Felipe Monteiro de Carvalho:

Show quoted text 11 lines
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. ;)

Joost

Reply by email