From: Lyle Johnson Date: 2002-08-01T11:01:04+09:00 Subject: Re: FXRuby: how do you capture a canvas resize? "Paul E.C. Melis" wrote in message news:ai9i7h$qpp$1@ares.cs.utwente.nl... > Did the same here on windows, it looks like it is a windows-only quirk: I > get four times that line, saying the canvas is 1x1 pixel... OK, I'm seeing the same behavior here under Windows. Looks like you might want to use a combination of the following: To get the initial *canvas* size, record the values for @canvas.width and @canvas.height after you've called FXCanvas#create but before actually entering the main event loop. For the scribble application, you'd want to add some lines to ScribbleWindow#create (which indirectly causes FXCanvas#create to be called): class ScribbleWindow < FXMainWindow def create super show(PLACEMENT_SCREEN) @canvasWidth = @canvas.width @canvasHeight = @canvas.height end end This is in *addition* to the event handler you added earlier, to catch SEL_CONFIGURE messages sent from the canvas: @canvas.connect(SEL_CONFIGURE) do |sender, sel, evt| if @canvas.width > 1 && @canvas.height > 1 @canvasWidth = @canvas.width @canvasHeight = @canvas.height end end Note the added check on reported canvas width and height, to avoid the bogus values you were getting before the window has actually been realized onscreen. Hope this helps, Lyle