[wxruby-users] wxDirDialog and show_modal don't work

Jonathan Maasland nochoice at xs4all.nl
Tue Jul 8 06:48:54 EDT 2008


Sorry about that, Thunderbird wasn't cooperating causing me to 
accidentally responded to the wrong message.

My bad.

Jonathan Maasland wrote:
> You are looking for the fit() method.
>
> From the docs:
> window.Fit(): The Fit() method sets the size of a window to fit around 
> its children. If it has no children then nothing is done, if it does 
> have children then the size of the window is set to the window's best 
> size.
>
> http://docs.wxwidgets.org/stable/wx_windowsizingoverview.html#windowsizingoverview 
>
> and
> http://wxruby.rubyforge.org/doc/window.html#Window_fit
>
> ps. frames that resize themselves aren't really considered 
> user-friendly either.
>
> Best of luck,
> Jonathan
>
> Petr Chelcicky wrote:
>> Hi,
>> I'm playing around with wxRuby and XRC and I'm unable to create modal
>> WxDirDialog. After opening it I'm always able to get focus on parent
>> window.
>>
>> class TestApp < Wx::App
>>     def on_init
>>      @test =  Main.new.show
>>     end
>> end
>>
>> class Main < MainFrame
>>    def initialize
>>      super
>>      self.size = ([133,191])
>>      evt_button(basic_config) { | event | butt_event(event)     }
>>    end
>>  end
>>
>> def butt_eventos(event)
>>     adr = Wx::DirDialog.new( @test, "Choose a folder")
>>     case adr.show_modal()
>>     when Wx::ID_OK
>>       puts "Directory: %s" %
>>         [ adr.get_path ]
>>     when Wx::ID_CANCEL
>>       puts "NOT OK"
>>     end
>>     adr.destroy()
>> end
>>
>>
>> After changing DirDialog to FileDialog or MessageDialog it works great,
>> and those dialogs are modal, so it looks that in Dirdialog is buggy, bt
>> maybe I'm doing something wrong. Any ideas? Thnx.
>> (I'm using latest wxRuby,wx_sugar, tested on winXP and Vista)
>>   
>
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>
>



More information about the wxruby-users mailing list