# FXDCWindow.drawText doesnt draw text

**URL:** <https://www.ruby-forum.com/t/fxdcwindow-drawtext-doesnt-draw-text/164796>\
**Category:** FXRuby\
**Created:** [April 6, 2009, 3:34am UTC](https://www.ruby-forum.com/t/fxdcwindow-drawtext-doesnt-draw-text/164796 "2009-04-06T03:34:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc79bd/32.png) [@tomast](https://www.ruby-forum.com/u/tomast)\
**Post date:** [April 6, 2009, 3:34am UTC](https://www.ruby-forum.com/t/fxdcwindow-drawtext-doesnt-draw-text/164796/1 "2009-04-06T03:34:30Z")

</div>

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?
