FXDCWindow.drawText doesnt draw text


#1

Hi guys, I am having a problem trying to draw text on a canvas. I have
the following code:

class Canvas < FXMainWindow
def initialize(xaApp,sTitle)
super(xaApp, sTitle,:opts => DECOR_ALL, :width => 800, :height =>
600)

@canvas = FXCanvas.new(self, :opts =>

LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)
@canvas.connect(SEL_PAINT){ |sender, sel, event|
FXDCWindow.new(@canvas, event){|dc|
dc.foreground = 0x000000
dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w,
event.rect.h)
f = FXFont.new(getApp(), “times”, 36, FONTWEIGHT_BOLD)
f.create
cd.font = f
dc.foreground = 0xFFFFFF
dc.drawText(10,10,“test”)
dc.end
}
}

end

def create
super
show(PLACEMENT_SCREEN)
end
end

When I make this canvas and show it, the fillRectangle works because the
background of the window is black, however the drawText doesnt - I dont
see any text on the screen at all.

Can anyone point me to where I am getting this wrong?