find what triggered OnPaint

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.
Post Reply
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

find what triggered OnPaint

Post by mael15 »

I have OnPaint events that I need to find the trigger for. I have caught all explicit Refresh() in my code using this with a breakpoint:

Code: Select all

void refresh() { Refresh(); }
But the OnPaint code is still called from somewhere else. This is in a class inheriting from wxScrolled<wxPanel> after an OnMouseWheel event, but I have some other class with the same inheritance where no OnPaint is triggered, so I guess this cannot be the cause.
Can I somehow find the cause for the OnPaint event?
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 474
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: find what triggered OnPaint

Post by doublemax@work »

OnPaint is really triggered by the OS, in a scrolledwindow, i'd guess the scrolling itself is responsible.
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: find what triggered OnPaint

Post by mael15 »

thanx, that´s what i thought, but like i wrote i have another class with the same inheritance and it does not trigger a paint event. so i thought this would exclude some internal wxScrolled<wxPanel> reason, but maybe both trigger the event and one of them vetos it somewhere? would be even more difficult to find then.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: find what triggered OnPaint

Post by PB »

On MSW, unless you disabled scrolling by EnableScrolling(false, false), scrolling should trigger WM_PAINT. It uses ::ScrollWindowEx() to scroll part of the window, which then asks the window to pain the unscrolled area.
Post Reply