Border Colors Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
fabianomartins
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Mar 17, 2009 1:36 pm

Border Colors

Post by fabianomartins » Tue Mar 17, 2009 1:49 pm

Hello all, how can I change the border color of a wxTextCtrl?

Thank's.

computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

Post by computerquip » Wed Mar 18, 2009 1:54 pm

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

catalin
Moderator
Moderator
Posts: 1594
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Post by catalin » Wed Mar 18, 2009 4:19 pm

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

fabianomartins
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Mar 17, 2009 1:36 pm

Post by fabianomartins » Wed Mar 18, 2009 5:10 pm

Thank's I'll try!

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Wed Mar 18, 2009 5:26 pm

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.

Post Reply