Grids: always use 'custom columns'
Original Reporter info from Mantis: Ask
-
Reporter name: Alexander S. Klenin
Original Reporter info from Mantis: Ask
- Reporter name: Alexander S. Klenin
Description:
Currently there is some discrepancies in Grid.ColCount vs. Grid.Columns.Count,
which can lead to user confusion and awkwardness.
Proposed design, after discussion in the mailing list thread "TStringGrid: ColCount vs Columns.Count", is as follows:
- All columns (including fixed ones) should always have 'custom column' available. That is, for each i in 0..Grid.ColCount-1 Grid.Columns[i]
should return valid TGridColumn.
- This should simplify code both user code and the code inside Grids unit,
as there is no need to check whether TGridColumn is available.
- Grid.Columns.Add should increase ColCount, and changes to Grid.ColCount should create/destroy TGridColumns as needed.
- For efficiency, TGridColumns can be created on-demand, i.e. upon calling Columns[i]. This way, users who never use 'custom columns' do not pay a price.
- At designtime, user should be able to use both 'columns editor'
and 'grid editor' without causing errors. Ideally, they should be united into a single interface (although this is probably a separate issue).
Mantis conversion info:
- Mantis ID: 12823
- Version: 0.9.27 (SVN)