Change border color of focused cell in wxGrid

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
fancyivan
Experienced Solver
Experienced Solver
Posts: 80
Joined: Wed May 26, 2010 8:42 am
Location: Beijing, China
Contact:

Change border color of focused cell in wxGrid

Post by fancyivan » Mon Jan 27, 2014 5:32 am

Hello,

when we click one cell in wxGrid, this cell will be focused and selected. there will be a BLACK border in the cell. if we select many cells, the BLACK border will change to WHITE.

is there any way to change this border color? is it hardcoded in source code?

Thank you.

Tao
Attachments
grid_sel_border.png
grid_sel_border.png (24.71 KiB) Viewed 1522 times
OS: Win7 Ultimate SP1 x64(Windows XP Pro SP3 in VirtualBox)
Compiler: MinGW32 (gcc4.8.1 + gdb7.6.1)
IDE: Code::Blocks 12.11
Lib: wxWidgets3.0.0

User avatar
doublemax
Moderator
Moderator
Posts: 14782
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Change border color of focused cell in wxGrid

Post by doublemax » Mon Jan 27, 2014 10:25 am

Code: Select all

void wxGrid::SetCellHighlightColour( const wxColour& colour )
void wxGrid::SetCellHighlightPenWidth( int width )
This methods seems to be missing from the documentation.
Use the source, Luke!

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

Re: Change border color of focused cell in wxGrid

Post by catalin » Mon Jan 27, 2014 10:44 am

AFAIK wxGrid::SetCellHighlightColour() will change only the colour of the highlighted cell border when there is no selection, a.k.a the black colour.
In order to change the white colour you most probably need to override wxGrid::DrawCellHighlight() in a derived class.

User avatar
silver.moon
Experienced Solver
Experienced Solver
Posts: 67
Joined: Fri Feb 20, 2015 6:13 am

Re: Change border color of focused cell in wxGrid

Post by silver.moon » Fri Jun 26, 2015 4:48 am

doublemax wrote:

Code: Select all

void wxGrid::SetCellHighlightColour( const wxColour& colour )
void wxGrid::SetCellHighlightPenWidth( int width )
This methods seems to be missing from the documentation.
Wow. I was looking for this for quite some time, to remove the thick border around selected cell.
Thanks

Post Reply