c++ - Can I run code *after* a built-in wxWidgets event is handled? -
i suspect there must built-in way this, google-fu has failed me.
i'm using wxscrolledwindow
, , have paint unscrolled background picture behind contents each time window scrolled. i've made scroll handler this...
void homewindow_t::onscroll(wxscrollevent &evt) { refresh(); evt.skip(); }
...which works force redraw entire window each time. unfortunately, draws window before scroll handled, background repainted , scrolled or down, screwing alignment. documentation suggests refresh
invalidates screen, meaning scroll handler must forcing redraw.
the way around can see handle scrolling code myself, i'd rather not if don't have to.
ideas, suggestions, clues...?
the general solution i've found running code after event handled post second, different event event queue before skipping current event (so gets handled default handler), , handle when comes up.
however, perusing wxwidgets source code, i've found answer specific problem: there's function, wxscrolledwindow::enablescrolling
. although it's not obvious name, enable or disable "physical scrolling," forces instant redraw. calling enablescrolling(false, false);
in window's constructor solves issue entirely.
Comments
Post a Comment