[fxruby-users] resizing main window on the fly

angico angico at angico.org
Thu Nov 6 14:53:30 EST 2008


Em Qui, 2008-11-06 às 12:01 -0600, Don Wilde escreveu:
> Hi, all -
> 
> Is it possible to resize the main window on the fly? I want to default
> to an 800x600 window but give the user an option to resize to 1024.
> 
> This approach didn't work:
> 
> class MyWindow < FXMainWindow 
>   def initialize( app )
>   #...
> 
>     @mainWindowWidth = 800
>     
>     # Build the overall Application GUI
>     # ---------------------------------
>     super( app, 
>            "  MyWindow  ", 
>            :width => @mainWindowWidth, :height => 600, :vSpacing =>
> 0 )
>   #...
>     winWidth = FXListBox.new( blk1, :opts => LISTBOX_NORMAL ) 
>     winWidth.appendItem("800")  
>     winWidth.appendItem("1024")  
>     winWidth.connect( SEL_COMMAND ) do | sender, sel, data |
>       @mainWindowWidth = data.to_i
>       app.forceRefresh
>     end
>   end
> end
> #...

When you say @mainWindowWidth = data.to_i you're just assigning variable
@mainWindowWidth a new value. It has nothing to do with the
application's main window's width.

Instead, try: 

    winWidth.connect( SEL_COMMAND ) do | sender, sel, data |
       resize(data.to_i, height)
    end
 

Hope this helps.

-- 

angico
------
home page: www.angico.org
Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I
------
contatos:
email: angico at angico.org
skype: an.gi.co
------



More information about the fxruby-users mailing list