Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxSmith maybe have a bug on "event code"

(1/2) > >>

nanyu:
step1: I create a new wx GUI(frame) project. and it use wxsmith.

step2: I place a wxPanel on the frame, and named it PanelGame

step3: I custom the panel's onpaint event by  wxSmith. now , I got this code:
 
   PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0,this);
   
... strange thing happen now... compile..link..and run this program... NOW, I can't close this program's main window. I click the close button which on the window's caption, It do nothing .

     AND: the OnPanel event didn't been called.

step4 : I modify the code:
      //PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0,this);
        PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0, 0);

now everything ok!

Is It a bug of wxWidgets (2.8.10/ wxMSW, compiled by mingw gcc 4.4.0)? or a bug of wxSmith?

------------
sorry for my poor Engilsh.
code::blocks svn6088. mingw gcc 4.4.0. windows xp.

rcoll:

--- Quote from: nanyu on February 19, 2010, 04:36:56 am ---step4 : I modify the code:
      //PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0,this);
        PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0, 0);

now everything ok!

--- End quote ---

No, it isn't, not really.  If you want it to work properly, put the code back the way that it was originally.
In addition, the wxPaintEvent event requires that you create a wxPaintDC for the target window (component) within the paint event code.  If you do not create this DC, then the code stack may become corrupted, and you might see things such as the program not closing correctly.

Get a copy of the wxWidgets documentation and read about the wxPaintEvent.

Ringo

nanyu:

--- Quote from: rcoll on February 19, 2010, 07:33:10 am ---
--- Quote from: nanyu on February 19, 2010, 04:36:56 am ---step4 : I modify the code:
      //PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0,this);
        PanelGame->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxTerisFrame::OnPanelGamePaint,0, 0);

now everything ok!

--- End quote ---

No, it isn't, not really.  If you want it to work properly, put the code back the way that it was originally.
In addition, the wxPaintEvent event requires that you create a wxPaintDC for the target window (component) within the paint event code.  If you do not create this DC, then the code stack may become corrupted, and you might see things such as the program not closing correctly.

Get a copy of the wxWidgets documentation and read about the wxPaintEvent.

Ringo


--- End quote ---

Thank you, you are right.

ppv:
I have the same problem and I have the DC:

see:
http://forums.codeblocks.org/index.php/topic,12018.0.html

ppv:
I had tried a lot of things but I don't understand why putting the (wxPaintDC dc(this);) doesn't work for me.

I'll apreciate any suggestion.

best regard

ppv

Navigation

[0] Message Index

[#] Next page

Go to full version