Page 1 of 1

Border Colors

Posted: Tue Mar 17, 2009 1:49 pm
by fabianomartins
Hello all, how can I change the border color of a wxTextCtrl?

Thank's.

Posted: Wed Mar 18, 2009 1:54 pm
by computerquip
Since no one has mentioned, I don't think this is a feature built into TextCtrl but I'm sure it can be done if you want to give it a shot :D

Posted: Wed Mar 18, 2009 4:19 pm
by catalin
Hi,

wxTextCtrl has native implementation so the border color is set by the OS theme.

You can try a workaround - use wxNO_BORDER for the wxText, add it to a sizer, add the sizer to a wxPanel of size
( 2*borderThickness + txtCtrl.width , 2*borderThickness + txtCtrl.height )
, draw a rectangle on the panel to replace the border of the wxTextCtrl.

HTH

Posted: Wed Mar 18, 2009 5:10 pm
by fabianomartins
Thank's I'll try!

Posted: Wed Mar 18, 2009 5:26 pm
by Auria
fabianomartins wrote:Thank's I'll try!
Please accept the post that helped you, not yours.

Thanks :)

PS: Just to add on Catalin's trick. There is very likely no need to manually set ( 2*borderThickness + txtCtrl.width , 2*borderThickness + txtCtrl.height ), as wxSizer::Add lets you specify a border. Also, you may not need to draw a rectangle on the panel, you might just want to set its background color, which is much simpler.