[Lazarus] Having more than 32 elements in a set (TGridOptions of TCustomGrid)

Michael Van Canneyt michael at freepascal.org
Wed Nov 5 16:31:17 CET 2014



On Wed, 5 Nov 2014, Werner Pamler wrote:

> For fpspreadsheet I would like to implement the feature of Excel or 
> Libre/OpenOffice that multiple cell ranges can be selected. The grid 
> component in this package, TsSpreadsheetGrid, currently can select only a 
> single range (if goRangeSelect is in the grid's Options) due to its 
> inheritance from TCustomGrid.

>>
> Recompiling the package LCLBase fails with the error: "Property can't have a 
> default value". I think this message is misleading and confusing because the 
> true issue seems to me that the set of TGridOptions now contains 33 elements. 
> In my understanding, the elements of a set correspond to the bits of an 
> integer. In a 32-bit OS, therefore, a set can only contain 32 elements - 
> there is one too many now...
>
> Is this interpretation correct?

Yes.

>
> OK, here I could circumvent this issue by introducing a new boolean property 
> "MultiSelect" which is evaluated when goRangeSelect is active. Maybe this is 
> even better than the goMultiSelect option because it bypasses the conflict 
> with goRangeSelect.
>
> But what if I would not have this possibility? Is there a way to extend the 
> set to more than 32 elements? If not, split the Options into groups of 
> options like VirtualTreeView does? I fear the options of the grid components 
> will require a major redsign soon.

The 32-bit limit cannot be circumvented easily. 
It would require a major redesign of streaming and rtti. 
Your fastest path is splitting the options.

Michael.




More information about the Lazarus mailing list