Oups, correct and test it too fast :o)
It's work when i test because center is default.

> > 
> >> Hi Blair,
> >>
> >>     Fix and commit on CVS.
> > or alternately (to expose that BS_CENTER is BS_LEFT | BS_RIGHT)
> > 
> >               SwitchBit(perlcs->cs.style, BS_RIGHT, 1);
> >               SwitchBit(perlcs->cs.style, BS_LEFT, 1);

I change -center with 2 SwitchBit.

> This is the only one that will work.  SwitchBit is not smart enough to 
> deal with multi-bit values.  If the previous value was BS_RIGHT or 
> BS_LEFT, SwitchBit is not smart enough to only turn on the other bit. 
> Because of its "if(!(mask & bit)) test, which will be false.  Nor is it 
> smart enough to turn off both bits with "SwitchBit(perlcs->cs.style, 
> BS_CENTER,0);", because it uses "mask ^= bit;" which will turn on the 
> other bit.
> 
> Really, it would be easier if there were a primitive that dealt with 
> setting bitfields of variable width.  Such exist, but not as part of 
> Win32::GUI.
> 
> #define SetBits(mask, bits)  {mask |= bits;}
> #define ResetBits(mask, bits)  {mask &= ~(bits);}
> #define SwitchBits(mask, bits, set) \
>   {if (set) SetBits(mask,bits) else ResetBits(mask,bits);}

Yes, you right. I keep this for later. 
I don't want to add more stuff now but only bug correction.

Laurent.


Reply via email to