mac 2,9 "Cannot nest wxDCs on the same window"
Riccardo Cohen
rcohen at articque.com
Tue Oct 2 03:09:11 PDT 2007
I agree and admit that it is the safiest way, but it is often easyer to
do a "draw now" under certain user action, rather than "change data"
then "refresh"...
For instance when a user select a zone, I have a mouse motion event, and
I want to draw a rectangle that follows the mouse to show the zone, I
can resize a rectangle object and then refresh, but it is easyer to call
drawrectangle() immediatly. The same for timer event : for blinking
objects I simpy change the color at each timer event and draw a little
point with this color.
My present problem is that I used this method quite often. Buf if quartz
does not allow it, I'll change my code.
By the way you spoke about measuring, it happens that in the destructor
of one of my windows, I have call some cleaning code that create a DC to
measure text size. This lead to an exception while in the window
destructor. Maybe you've got an idea for that point also.
Thanks for your great work anyway.
Stefan Csomor wrote:
> Hi
>> On Mon, 01 Oct 2007 09:55:15 -0700 Robin Dunn <robin at alldunn.com> wrote:
>>
>> RD> Riccardo Cohen wrote:
>> RD> > Hi
>> RD> > I have a program that works on wxmac2,7 , but with 2,9 it
>> displays the RD> > following assertion : "Cannot nest wxDCs on the
>> same window"
>> RD> > RD> > this happens when I do
>> RD> > RD> > wxClientDC *dc=new wxClientDC(diag);
>> RD> > dc->DrawRectangle(rec);
>> RD> > delete(dc);
>> RD> > RD> > inside a timer_wake event.
>> RD> > I do not understand exactly what it means.
>> RD> RD> You can not have more than one wxDC active at the same time
>> for the same RD> window. Somewhere you have another DC already using
>> diag when the code RD> above is called.
>>
>> This seems like a rather bad restriction. I wonder if we couldn't make
>> all wxClientDC instances on the same window use the same underlying
>> CGContext somehow. It could still result in problems with changing DC
>> attributes but if we restored them carefully, it would allow something
>> (common) like this:
>>
> I've tried this in earlier times, but I was not successful when another
> context for another wxWindow on the same toplevel window that was
> currently drawing was requested, but since now all code is Quartz only,
> I could try again.
>
> Neverthelesss I really think that every drawing has to be moved to a
> OnPaint event, and the only reason to use a dc outside is for measuring
> purposes, which already can be done. It is the way the new drawing
> systems perform optimally, intermittent drawing leads to synchronization
> bottlenecks.
>
> Best,
>
> Stefan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
--
Très cordialement,
Riccardo Cohen
-------------------------------------------
Articque
http://www.articque.com
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49
More information about the wx-users
mailing list