 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Fullerton Guest
|
Posted: Mon Nov 24, 2003 9:11 pm Post subject: Saving DBGrid column positions and widths? |
|
|
Suppose I use a TDBGrid that can be connected to several datasources.
I would like to be able to save the column positions and widths for
each datasource. Is this possible? I wrote a routine to do this but it
only works if the columns are persistant and not generated on the fly.
In this case the columns are there but you can't seem to access them
using the .Columns property.
___
Free Project Time Tracker for Delphi Developers
http://www.cyber-matrix.com/pcdelphi.html
|
|
| Back to top |
|
 |
Quasidata Guest
|
Posted: Tue Nov 25, 2003 6:13 am Post subject: Re: Saving DBGrid column positions and widths? |
|
|
Hello Michael,
Here is an idea, not tested. Whether the grid saves its columns in the
stream is decided in TCustomDBGrid.DefineProperties based on the
Columns.State value. TDBGridColumns.GetState contains just one line
Result := TDBGridColumnsState((Count > 0) and Items[0].IsStored);
TColumn.IsStored is a protected property which assigns the field directly
without a write method. So I think it is possible, using the type-cast
hack, to access the property. Set temporary it to csCustomized, store the
grid, and set it back.
Also, look at TCustomDBGrid.WriteColumns and TCustomDBGrid.ReadColumns.
Probably you can imitate what they do.
Andrei Fomine www.quasidata.com
DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid.
Transfer@Once - full-blown clipboard and drag-and-drop data transfer
to/from any control in many formats, including ones native to MS Office.
"Michael Fullerton" <fullerm (AT) spamkiller-remove (DOT) cyber-matrix.com> wrote in
message news:ems4sv8ks074qofe3nqgd3g5prdrmg7ldo (AT) 4ax (DOT) com...
| Quote: | Suppose I use a TDBGrid that can be connected to several datasources.
I would like to be able to save the column positions and widths for
each datasource. Is this possible? I wrote a routine to do this but it
only works if the columns are persistant and not generated on the fly.
In this case the columns are there but you can't seem to access them
using the .Columns property.
___
Free Project Time Tracker for Delphi Developers
http://www.cyber-matrix.com/pcdelphi.html
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|