wxMac, PaintEvent

Nusret Taşçı nusi at sofha.de
Mon Sep 18 07:10:15 PDT 2006


> the OS redraw event is translated into a wxPaintEvent, so this works the
> same, so the reason it is not triggered must be something else, what
> happens if you don't connect your erase or paint handlers, but just set
> the background to red, do you see it at all ? ie is it visible and sized
> correctly ?

Yes. I only added a wxPanel to the XRC with same parameters as the other 
panels (only background set to red). It gets resized correctly and it's red.

We just detected that calling refresh() for a wxPanel 
(pPanel->Refresh()) doesn't cause the parent to get the paint event. In 
opposite to windows, where the parent gets that event, too.

I seem to have a wrong understanding here. Who should get paint events, 
if I Refresh() a child of a dialog/panel/window? Is the answer 
different, if the child is a wxPanel?

I now tested following:
If I derive my own class from wxPanel and let it create by the XRC 
handler, than instances of this class don't get a Paint-Event on 
Windows. However, they do get them on the Mac.

> Just a few shots in the dark ...

Do you have more shots? :)

I really seem to have a wrong understanding of how wxPanels should be 
used. Currently, I use (some of) them as a 'paintable window', where the 
parent of the panel decides what to draw on it.

Imagine a typical layout: on the left side of the dialog you have 
buttons and checkboxes and on the right side you have a preview (THE 
wxPanel). Whenever one of the buttons is pressed, the preview gets 
Refresh()'ed.
Im not sure if the controls should refresh the whole parent, which 
currently seems to be the only solution to fix the behaviour for Mac.


Nusi




More information about the wx-users mailing list