Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: nishalns on July 26, 2013, 06:23:42 am
-
Actually, i'm creating a simulator type application. Now, there is a panel called 'drawingPanel' on which they simulation takes place. Now, in my program I want to paint on this panel with another thread, 'simulationThread'. But when I try to paint on the panel from inside the Entry() function of the thread using wxDC, I get a "wx debug alert" message box, saying
../../src/msw/dcclient.cpp(222):assert "Assert failure" failed in wxPaintDCImpl(): wxPaintDCImpl may be only created in EVT_PAINT handler! [in thread e0]
Do you want to stop the program?
You can also choose [cancel] to suppress further warnings.
And the program execution stops.
I do understand what the error message means, but I don't know how to fix it. Can somebody help?
-
If this is wxWidgets version 2.9 or higher please ask in the wxWidgets forum.
http://forums.wxwidgets.org/ (http://forums.wxwidgets.org/)
If not, please state Compiler, Code::Blocks, and wxWidgets version info.
Tim S.
-
This is a wxWidgets related question, so it is not related to C::B, so your topic may be locked.
But I can give you some direction:
1, it is generally not a good idea to draw GUI from a worker thread.
2, "wxPaintDCImpl may be only created in EVT_PAINT handler", you can't use wxPaintDC here, maybe you should try wxClientDC or other things I don't know.
3, http://forums.wxwidgets.org/ is a good place to ask.
-
Thanks all for your replies especially "ollydbg". I was actually using wxPaintDC and i changed to wxClientDC and wollah! it worked! Thank you very much.... ;D