Hi Blair,
Fix and commit on CVS.
Problem come from BS_CENTER style is BS_LEFT | BS_RIGHT so SwitchBit
order it's important.
I rewrite like this :
if(strcmp(option, "-align") == 0) {
// BS_CENTER is BS_LEFT | BS_RIGHT
if(strcmp(SvPV_nolen(value), "left") == 0) {
SwitchBit(perlcs->cs.style, BS_RIGHT, 0);
SwitchBit(perlcs->cs.style, BS_LEFT, 1);
} else if(strcmp(SvPV_nolen(value), "center") == 0) {
SwitchBit(perlcs->cs.style, BS_CENTER, 1);
} else if(strcmp(SvPV_nolen(value), "right") == 0) {
SwitchBit(perlcs->cs.style, BS_LEFT, 0);
SwitchBit(perlcs->cs.style, BS_RIGHT, 1);
} else {
if(PL_dowarn) warn("Win32::GUI: Invalid value for -align!");
}
}
Thank for bug report.
Laurent.
> I've noticed that the button attribute "align" breaks if you specify
> "center", if empty it works (i.e. default).
>
> <pre>
> use Win32::GUI;
> my $W = new GUI::Window(-height=>100,-width=>100);
> my $B = $W->AddButton(-text=>'Test', -width=>'100', -align=>'center');
> $W->Center();
> $W->Show();
> Win32::GUI::Dialog;
> </pre>
>
> If one replaces "center" with "right" it works as expected. The error is
> not apparent in Button.xs and I've happens on XPsp2 and W2Ksp4.
>
> Blair
>