Forum: FXRuby FXDCWindow.drawText doesnt draw text

C5448702e5a55e59175aed325cd6bff0?d=identicon&s=25 Tomas Na (tomast)
on 2009-04-06 03:34
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?
This topic is locked and can not be replied to.