[fxruby-users] Beginner Q: can't get window to show in response to button press

Lyle Johnson lyle at lylejohnson.name
Wed Jun 24 10:13:02 EDT 2009

On Jun 24, 2009, at 1:22 AM, Marlene Phillips wrote:

> I'm trying to get text on to the screen in response to pressing a
> button.  My puts command says that the window is shown, but it's not  
> displayed.

The problem is that merely calling show() on a widget (in this case,  
the horizontal frame "yesWindow") doesn't mark the parent window's  
layout as dirty, and so it doesn't know that it needs to repaint its  
contents. The easiest way to fix this is to just add a call to  
recalc() after the call to show(), e.g.

	hearButton.connect(SEL_COMMAND) do

This topic is discussed in detail in Chapter 7 of the FXRuby book.

Hope this helps,


"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!

More information about the fxruby-users mailing list