It's Friday afternoon just before a long weekend and my brain is mush.
Having said that, I'm getting a little frustrated with putting a bitmap
on a wx.combo.OwnerDrawnComboBox.
I've subclassed ODCB and overridden OnDrawItem. I have some bitmaps as
XPMs in code, done up in a dictionary with item:bitmap. My OnDrawItem
subroutine is simple:
class MarkerTypeComboBox(wx.combo.OwnerDrawnComboBox):
def OnDrawItem(self, dc, rect, item, flags):
if item == wx.NOT_FOUND:
return
bmp = wx.BitmapFromXPMData(MARKER_DICT[item])
drawX = 48
drawY = 3
dc.DrawBitmap(bmp, drawX, drawY, True)
def OnMeasureItem(self, item):
return 24
def OnMeasureItemWidth(self, item):
return -1
I believe that this should draw the bitmap all the time.
What happens is that when the ODCB is initially drawn in my dialog box,
it looks fine: the default item is drawn properly. When the ODCB is
expanded, however, only item 0 is drawn correctly. The other rows show
up as blank. However, if I scroll through the list (it's a list of 21
items) and scroll back up to item 0, the items that have scrolled off
and then back on display correctly.
Any thoughts? What am I doing wrong?
Thanks,
Anthony.
···
--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA
Email: Anthony.Floyd@convergent.ca | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659
CMT is hiring: See http://www.convergent.ca for details