Ticket #14916 (closed defect: fixed)
Regression: wxTextMeasure breaks wxGCDC DrawText on wxMSW
| Reported by: | robind | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9.5 |
| Component: | wxMSW | Version: | 2.9-svn |
| Keywords: | wxTextMeasure wxGCDC GetHDC regression | Cc: | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
The assert in wxTextMeasure::BreginMeasuring is being triggered when trying to draw text on a wxGCDC, either with DrawLabel, or with DrawText when there is a newline in the text. For example:
>>> bmp = wx.EmptyBitmap(100,100)
>>> dc = wx.GCDC(wx.MemoryDC(bmp))
>>> dc
<wx._gdi.GCDC; proxy of <Swig Object of type 'wxGCDC *' at 0x3638110> >
>>>
>>> dc.DrawText("Hello\nWorld", 5, 5)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\PROJECTS\wx\2.9\wxPython\wx\_gdi.py", line 3823, in DrawText
return _gdi_.DC_DrawText(*args, **kwargs)
PyAssertionError: C++ assertion "m_hdc" failed at ..\..\src\msw\textmeasure.cpp(65) in wxTextMeasure::BeginMeasuring(): Must not be used with non-native wxDCs
Can this be worked around in wxTextMeasure, or should wxGCDC be able to return a valid handle from GetHDC?
Change History
Note: See
TracTickets for help on using
tickets.
