DBGrid and Text Wrapping lazarus / 16-Databases ---------------------------------------------------------------------- gkelby · 2014-03-02 23:55 Does anyone know how to wrap the text in the header column of a DBGrid component?  I have several columns that require a small width where the text in the header column is too long for the column width.  I would like to be able to wrap the header text within the defined column width.  I can't seem to find any options to do this in the Object Inspector. Thanks... GK ---------------------------------------------------------------------- jeanchristophe · 2014-03-03 10:37 Did you try something like this: QuoteDBGrid1.Columns.Items.Title.Caption:=newname; DBGrid1.Columns.Items.Width:=widthn; I try to google "lazarus dbgrid column name" and got "About 342,000 results (0.39 seconds)" Best Regards Jean-Christophe ---------------------------------------------------------------------- GADZombie · 2014-03-03 10:46 Quote from: gkelby on March 03, 2014, 12:55:17 amDoes anyone know how to wrap the text in the header column of a DBGrid component?  I have several columns that require a small width where the text in the header column is too long for the column width.  I would like to be able to wrap the header text within the defined column width.  I can't seem to find any options to do this in the Object Inspector. If there is no other method, just user OwnerDraw and draw your text using DrawText method with DrawFormat := DT_TOP or DT_WORDBREAK; You'll have word breaking and other goodies with this method (i.e. you could add an icon to text or change anything else. ---------------------------------------------------------------------- krzynio · 2014-03-11 20:27 Hi! Try hacking DBGrid. Below article should be helpful. I wrote my own DBGrid as descendant of TDBGrid with filters in header row using this method. Using it allows you to change height of header row, than you can use OwnerDraw for writing on it. http://delphi.about.com/od/oopindelphi/l/aa082603a.htm You may also be interested in KGrid instead of standard DBGrid. http://www.tkweb.eu/en/delphicomp/kgrid.html ---------------------------------------------------------------------- gkelby · 2014-03-23 07:51 Thanks for the responses.  I've realized there is no easy answer so instead I've named the grid columns to the table field names and gave the columns their own captions.  That works with the "Select *..." format.  I'll just have to wait for, maybe, an enhancement upgrade but I won't be holding my breath... Thanks... GK ---------------------------------------------------------------------- patyi · 2014-03-23 16:02 Hi ! Why don't try RxDBGrid ? RxDBGrid has ability of multi line header with | character delimiter ! ---------------------------------------------------------------------- gkelby · 2014-03-24 00:01 Hi; Sorry, where would I find RxDBGrid?  I do see it as part of the controls set in Lazarus 1.1.99. Thanks... Gk. ---------------------------------------------------------------------- patyi · 2014-03-24 06:30 http://wiki.freepascal.org/RXfpc