Sean Healy wrote:
> I searched the archives, but could not find what I needed.
> Is there actually a way to change the background color of a
> textfield after it is created?  I can do it with foreground
> color, but not background.  The closest thing I found in the
> archives was this from Aldo:
>
>$Richedit->SendMessage(1091, 0, hex('00FF00'));
>
> this sets the background color to green.
> note that the hex() format for the color is expressed
> as BBGGRR (BB=blue, GG=green, RR=red).
> BTW, 1091 stands for EM_SETBKGNDCOLOR.
>
> Perhaps this only works for richedit controls.  Is there a way
> to do it for plain old textfields?

yes, the trick above works for RichEdit only. Textfield does
not support EM_SETBKGNDCOLOR.
have you tried this:

    # change to red
    $Textfield->Change( -background => [ 255, 0, 0 ] );
    # repaint the control
    $Textfield->InvalidateRect(1);

hope this helps.

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;


Reply via email to