« Return to Thread: Beginner Q: can't get window to show in response to button press

Re: Beginner Q: can't get window to show in response to button press

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View in Thread


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
                yesWindow.show
                yesWindow.recalc
        end

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

Hope this helps,

Lyle

---
"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!
http://www.pragprog.com/titles/fxruby





_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

 « Return to Thread: Beginner Q: can't get window to show in response to button press