Page 1 of 1

Invalid DC for DoGetTextExtent

Posted: Mon Mar 09, 2009 9:02 pm
by ninja9578
This code is giving me a problem:

Code: Select all

     wxMemoryDC memdc;
     long int x, y;
     string temp = "Hello World!";
     if (ffont -> Ok()){
        memdc.GetTextExtent(wxString::FromAscii(temp.c_str()), &x, &y);
It works under windows, but not under OSX. A popup window comes up displaying:
../src/common/dcgraph.cpp(825): assert "Ok()" failed in DoGetTextExtent(): wxGCDC(cg)::DoGetTextExtent - invalid DC

Posted: Tue Mar 10, 2009 9:13 am
by lester
wxBitmap bmp( 1, 1 );
wxMemoryDC memdc( bmp );


Posted: Tue Mar 10, 2009 4:59 pm
by ninja9578
Guess what... you're the man :D