[wx-dev] wxHtmlListbox (GetSelectedTextColour) broken in trunk

Belgabor belgabor at gmx.de
Sun Mar 2 07:14:55 PST 2008


Hi Vadim,

Vadim Zeitlin schrieb:
> On Sun, 02 Mar 2008 05:52:33 +0100 Belgabor <belgabor at gmx.de> wrote:
> =

> B> wxHtmlListbox::GetSelectedTextColour, or rather whatever should call i=
t, =

> B> is broken in trunk. My subclass overwrites it and it's never called =

> B> (works fine in 2.8.7).
> =

>  I don't see anything obviously wrong or even obviously different from 2.8
> version in the trunk code, could you please check where is it called from
> in 2.8 and why this doesn't happen in the trunk?

There is a junk of code that disappeared from the OnDrawItem method. If =

I put it back, it works. I've attached a patch that does it. There is =

one caveat though, wxHtmlListBox fails to set the correct platform =

default selection background. On Windows XP this is a dark blue for me, =

but the text background is drawn black while the rest of the cell's =

background is drawn (as expected) in dark blue. As soon as you call =

SetSelectionBackground, it works correctly (cell and text are drawn with =

the same background colour). You probably know better than me where to =

fix that cleanly.

Cheers
Tobias
-------------- next part --------------
Index: src/generic/htmllbox.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/generic/htmllbox.cpp	(revision 52237)
+++ src/generic/htmllbox.cpp	(working copy)
@@ -365,6 +365,17 @@
 =

     wxHtmlRenderingInfo htmlRendInfo;
 =

+    // draw the selected cell in selected state
+    if ( IsSelected(n) )
+    {
+        wxHtmlSelection htmlSel;
+        htmlSel.Set(wxPoint(0,0), cell, wxPoint(INT_MAX, INT_MAX), cell);
+        htmlRendInfo.SetSelection(&htmlSel);
+        if ( m_htmlRendStyle )
+            htmlRendInfo.SetStyle(m_htmlRendStyle);
+        htmlRendInfo.GetState().SetSelectionState(wxHTML_SEL_IN);
+    }
+
     // note that we can't stop drawing exactly at the window boundary as t=
hen
     // even the visible cells part could be not drawn, so always draw the
     // entire cell


More information about the wx-dev mailing list