[lazarus] Win32 menu does not work

Micha Nelissen mdvpost at hotmail.com
Tue Jun 24 06:40:22 EDT 2003


Micha Nelissen wrote:
> Marco van de Voort wrote:
>>>> TBits is implemented, so you can try it.
>>>
>>> Hmm, it seems it uses 4 bytes per bit entry. A little overkill if
>>> you ask me :). They surely could have simpy used 1 byte? Anyway, I
>>> will try it. Shall I create the bit array in win32int.pp?
>>
>> Wouldn't limit that forms to 256 controls?
>
> Heh. No. Please take a look at bits.inc and you will understand what
> I mean. TBits is a long array of 'bits'. Undeterminate length in
> delphi, in fcl it seems you need to know in advance :(. Each bit
> takes a certain amount of space. The smallest is 1/8th of a byte (as
> delphi uses), but the fcl uses 4 bytes.

After a second look, I see it doesn't use 4 bytes per bit, only 1 bit per
bit, but they do allocate in 4 byte blocks, probably for efficient integer
operations. They first div by 32 * 4 and then multiply by 4 and add some.

Anyway, the implementation doesn't matter much, as long as I can find a way
to dynamically increase the size and find out how to determine if all bits
are set. The return value of OpenBit still confuses me a bit :). Sometimes
it sets Result to FSize * 32, but sometimes it does not.

Regards,

Micha.






More information about the Lazarus mailing list