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.
I am using wxDataViewCtrl to display a table.When the row or wxDataViewItem is selected, the font color becomes white. I found that wxDataViewCustomRenderBase use the static class wxSysSettings::GetColor to get a default color. Is there any way to change the font color without modifing wxWidgets ' src code.
Thanks, wxWidgets 3.0.4, visual studio 2015, Windows 7.
///
/// call stack:
/// wxDataViewMainWindow::OnPaint
/// wxDataViewCustomRenderBase::WXCallRender
///
// set up the DC attributes
// override custom foreground with the standard one for the selected items
// because we currently don't allow changing the selection background and
// custom colours may be unreadable on it
wxColour col;
if ( state & wxDATAVIEW_CELL_SELECTED )
col = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
else if ( m_attr.HasColour() )
col = m_attr.GetColour();
else // use default foreground
col = GetOwner()->GetOwner()->GetForegroundColour();
wxDCTextColourChanger changeFg(*dc, col);
wxDCFontChanger changeFont(*dc);
if ( m_attr.HasFont() )
changeFont.Set(m_attr.GetEffectiveFont(dc->GetFont()));
Render(rectItem, dc, state);
Hi,
Which data you display in order to use custom renderer?
But to answer you question - sis you try to override "virtual bool wxDataViewCustomRenderer::Render()"?
ONEEYEMAN wrote:Hi,
Which data you display in order to use custom renderer?
But to answer you question - sis you try to override "virtual bool wxDataViewCustomRenderer::Render()"?
Thank you.
The column I use my derived renderer is ok. However, it is not smart to replace default renderer with my derived renderer, there would be too much work. Well, there is no way to change the default color without changing the source of wxWidgets. Fortunately, after asking PM, there is no need to face the problem.