wxGTK1
Milan Babuskov
milanb at panonnet.net
Fri Dec 21 03:38:44 PST 2007
Vadim Zeitlin wrote:
> MB> Ok, here's the first problem. You can see it in the 'treectrl' sample,
> MB> without any modifications [wx2.8.6, gtk 1.2.10):
> MB>
> MB> - start the treectrl sample
> MB> - click on '+' to expand the root node
> MB> - clicking on any child nodes doesn't select them (root node does lose
> MB> focus though).
> MB>
> MB> OnSelChanging and OnSelChanged events do fire, but there is no visual
> MB> indication.
>
> Yes, I can confirm this (and in the widgets sample -- which uses
> wxTreeCtrl -- too). I really don't know why should it be broken for wxGTK1
> as the code is mostly generic but I'll try to have a look... Of course, I'd
> appreciate any help, as usual.
I thing I found the problem, but maybe a deeper knowledge of wx
internals would be needed to fix it properly.
There is a code in wxGenericTreeCtrl::Refresh that calls the control to
update. I checked it run-time and it does have the correct wxRect set
up. It calls wxTreeCtrlBase::Refresh but it looks like this function
isn't implemented anywhere, so it just calls wxControl::Refresh which
(again) only seems to be implemented for Mac classic and carbon, so it
actually calls wxWindow::Refresh for Gtk1.
Now, there are two different wxWindowGTK::Refresh, one in gtk/window.cpp
and other in gtk1/window.cpp. The code seems the same when we exclude
the #ifdefs. I traced it there and it follows this path (when non-root
node is selected):
m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height );
m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
I checked and the rect is the correct one.
As the comments in code say, this should "schedule the area for later
updating in GtkUpdate()", but I don't see any code that would actually
call GtkUpdate() to do the job? My guess is that idle event handler
should do that, but g_isIdle is never true, so it never happens.
Adding a call to Update() at the end of wxGenericTreeCtrl::Refresh makes
it work, but as I said, I don't know that much of internals, so I'm not
sure if that is a proper fix.
--
Milan Babuskov
http://www.flamerobin.org
More information about the wx-users
mailing list