From: "Daniel P. Zepeda" Date: 2003-01-14T18:46:04+09:00 Subject: FXRuby problem on Windows Hi, I've cut down a larger program to this test case that shows a problem on windows. When I run this on my Linux box, I get an application window with some colored boxes and the string "Hi There, (I'm on my way, I'm making it) in it. When I run this same program on my Windows box, I get Zip, nada, at first a gray window, then a transparent one if I minimize thenmaximize the window. Some debugging statements show that onPaint *is* getting called. Can anyone tell me what the problem is here? I know that this sort of coding works because in my larger application, *something* gets drawn to the screen on my windows box, certainly not everything that is supposed to be drawn to it though, and on my Linux box, everything works just peachy. The problem box is an older Compaq Armada laptop with around 48 megs of memory running Windows 95, and the latest Ruby 1.6.8 installed from the sourceforge site that the Pragmatic Programmers so kindly provide. Regular Widgets get drawn fine, but only the first part of one canvas is ever drawn, and that is it, although the rest of the program runs fine, I can tell because the other widgets (buttons, spinners, labels, etc. ) are updated properly. Here is the program: #!/usr/bin/env ruby require 'fox' require 'fox/colors' include Fox class DcProb < FXMainWindow def initialize(app) super(app, "Show Drawing Context Problem", nil, nil, DECOR_ALL, 0, 0, 400, 300) @canvas = FXCanvas.new(self, nil, 0 , (FRAME_SUNKEN| FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT),0,0,400,3 00) @canvas.connect(SEL_PAINT, method(:onPaint)) @image = FXImage.new(app, nil, IMAGE_SHMI|IMAGE_SHMP) @font= FXFont.new(app, "arial", 12, FONTWEIGHT_BOLD) end def create super @font.create @image.create @canvasWidth = @canvas.getWidth @canvasHeight = @canvas.getHeight @image.resize( @canvasWidth, @canvasHeight ) @sdc = FXDCWindow.new( @canvas ) @idc = FXDCWindow.new( @image ) @idc.setForeground( FXColor::White ) @idc.fillRectangle( 0,0, @canvasWidth, @canvasHeight ) step = 5 0.step(50, step ) { |y| 0.step(50, step ) { |x| @idc.setForeground(FXRGB( rand(255), rand(255), rand(255))) @idc.fillRectangle( x,y, x+@canvasHeight, y+@canvasWidth ) } } @idc.fillRectangle( 50,50, @canvasWidth, @canvasHeight ) @idc.setForeground(FXColor::Black) @idc.setTextFont( @font ) @idc.drawText( 60,80, "Hi There, (I'm on my way I'm making it!)") show(PLACEMENT_SCREEN) end def onPaint( sender, sel, event ) @sdc.drawImage( @image, 0,0 ) end end if __FILE__ == $0 application = FXApp.new("DcProb", "zepeda-zone.net") application.init(ARGV) DcProb.new(application) application.create application.run end -- "Daniel P. Zepeda" (Remove commas for address)