wxScrolledWindow update different under Mac and Linux/Windows

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

Hi,

I did not find an answer to the following scroll problem using the mousewheel.
Clicking on the scrollbar the behaviour is comparable on all platforms.
But using the mousewheel its only OK under Mac.

I have a wxScrolledWindow with a header which should be always visible independent of the vertical scroll position.
Using

Code: Select all

  int xoffset = 0;
  int yoffset = 0;
  GetViewStart( &xoffset, &yoffset );
will provide the right offsets*scrollunits on all platforms, but under Linux/Windows the drawing area seems to be clipped and by using the mousewheel the header disappears. (Not under Mac...)
I tried using DestroyClipRegion() before painting, but this does not help.

How can I invalidate the whole visible canvas in the wxScrolledWindow? (Full repaint on resize does also not help...)

In short: I need to update an area which is not invalidated by scrolling with the mousewheel.
Mac
Mac
Linux
Linux
Linux back scroll
Linux back scroll
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by doublemax »

I would have expected that wxFULL_REPAINT_ON_RESIZE works. I'm pretty sure at least under Windows it would.

As a workaround i would catch all scroll events and call

Code: Select all

Refresh();
evt.Skip();
in the event handler.
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

Hi,

I#m catching the wxEVT_MOUSEWHEEL event and

Code: Select all

Refresh();
event.Skip();
which looks almost OK under Linux, but with some hicks.
Could double buffering be of help?
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

with wxBufferedPaintDC its OK.

Thanks for your advice.
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by doublemax »

If it's just flickering, double buffering will help. If it's some kind of drawing error, probably not.

FWIW, i don't think that catching the mouse event does the same as catching the scroll event. You should at least try that. It's also very weird, that the problem only shows the using the scroll wheel.
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

I did try the wxEVT_SCROLL to catch all events, but despite its in the wx manual it does not exist.
Then I did try all other scroll events, but none of them did occur, only the mousewheel event...

But the final result is not as good as under OSX.

Any other ideas?
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

this is the result testing under win10:
Screenshot (7).png
it looks like the mousewheel event occurs before the scrolling...
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by doublemax »

it looks like the mousewheel event occurs before the scrolling...
That's what i suspected.

You need the wxEVT_SCROLLWIN* events, wxEVT_SCROLL* is for (separate) scrollbars.
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: wxScrolledWindow update different under Mac and Linux/Windows

Post by rocrail »

OK, with the wxEVT_SCROLLWIN* events it works.
Many thanks. :)
Best regards,
Rob.
https://wiki.rocrail.net
Post Reply