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

Flávio Etrusco flavio.etrusco at gmail.com
Thu Nov 6 04:43:21 CET 2014


On Wed, Nov 5, 2014 at 12:33 PM, Bart <bartjunk64 at gmail.com> wrote:
> On 11/5/14, Werner Pamler <werner.pamler at freenet.de> wrote:
>
>> 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?
>
> I think it's not.

AFAICS it is.

> Default values must be of ordinal, pointer or small set type (Delphi)
> (See: http://docwiki.embarcadero.com/RADStudio/XE7/en/E2146_Default_values_must_be_of_ordinal,_pointer_or_small_set_type_%28Delphi%29)
>
> After you added the 33-rd option now SizeOf(TGridOptions) = 32 bytes.
> Every option is stored as a bit, so you can have 256 (=32*8) options (I think).

No, SizeOf(TGridOptions) = 4 (bytes) = 32 bits = 32 options.

Best regards,
Flávio




More information about the Lazarus mailing list