Lazarus

Programming => LCL => Topic started by: erictan on June 11, 2020, 05:28:53 am

Title: How to display first memo line in DBGrid
Post by: erictan on June 11, 2020, 05:28:53 am
I have a Customer Form displaying all the fields of a Customer table in a DBGrid.
The address field is a Memo field and only shows "Memo" in the DBGrid.
How do I show the first line of the Address memo field instead of just showing "Memo" in the DBGrid.

I have tried googling for a solution without success.

All suggestions and advise are greatly appreciated.
Title: Re: How to display first memo line in DBGrid
Post by: eljo on June 11, 2020, 06:07:34 am
A quick google search reveals the following link.
https://wiki.lazarus.freepascal.org/Grids_Reference_Page#Example:_Avoid_displaying_text_fields_as_.22.28Memo.29.22_for_DBGrids (https://wiki.lazarus.freepascal.org/Grids_Reference_Page#Example:_Avoid_displaying_text_fields_as_.22.28Memo.29.22_for_DBGrids)

I'd bet a search in the forum will reveal a number of threads with the same theme.
Title: Re: How to display first memo line in DBGrid
Post by: erictan on June 11, 2020, 08:56:24 am
Thank you eljo for your reply, nteresting link which I will explore further.

Essentially I want to be able to extract all the fields, including Memo fields, using 'Select * From" and do some editing but to display only the first line of each memo field in the DBGrid so that I know the content of each memo field.

I would thought that this could be possible by specifying in the Object inspector Fieldname as 'address.lines[1]'.

This feature is easily and similarly done in the Visual Foxpro IDE.
Title: Re: How to display first memo line in DBGrid
Post by: paweld on June 11, 2020, 10:21:32 am
you can also get it using OnGetText event - sample in attachement.
TinyPortal © 2005-2018