Is it allowed to Refresh() wxWindow from OnPaintEvent another brother wxWindow?

24 views
Skip to first unread message

Black Jack

unread,
Mar 20, 2025, 2:29:08 PM3/20/25
to wx-u...@googlegroups.com
Hello wx-users

I have wxScrolledWindow that have two wxWindows children.

I'd like to know is it allowed to Refresh() wxWindow from OnPaintEvent another brother wxWindow?

Here is my code, it works OK.

void firstWxWindow::OnPaint(wxPaintEvent& event)
{
    wxPaintDC dc(this);
    //here goes any code
   
    // here is statment I'd like to know is it allowed to do so?
    anotherWxWindow->Refresh();
}

Won't this create any problems?

Thanks in advance.

Vadim Zeitlin

unread,
Mar 20, 2025, 2:45:38 PM3/20/25
to wx-u...@googlegroups.com
On Thu, 20 Mar 2025 21:28:49 +0300 Black Jack wrote:

BJ> I have wxScrolledWindow that have two wxWindows children.
BJ>
BJ> I'd like to know is it allowed to Refresh() wxWindow from OnPaintEvent
BJ> another brother wxWindow?

It's not exactly disallowed, but it's definitely strange and unusual
because paint events may happen for many different reasons and it's not
clear at all why repainting one window should result in repainting another
one.

The usual situation is that both windows display some data (or something
using some data) and in this case they should be both refreshed when this
data changes.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages