[wxruby-users] Initializing a Frame seems to fail...

Alex Fenton alex at pressure.to
Wed Jan 14 18:14:23 EST 2009


Tim Mcd wrote:
> Correct parameters for Wxruby2::Frame.new are:
> :id => (Fixnum)
> :title => (String)
> :pos => (Wxruby2::Point)
> :size => (Wxruby2::Size)
> :style => (Fixnum)
> :name => (String)
>   from /Users/Tim/wxrmc.rb:9:in `on_init'
>   from /Users/Tim/wxrmc.rb:21:in `main_loop'
>   from /Users/Tim/wxrmc.rb:21
>
>   
....
> Thats the error for this line:
>     @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION,
> Point.new(300, 875))
>   

Check again: you should be passing a Wx::Size here, not a Wx::Point - 
you've already passed in the position with DEFAULT_POSITION.

It's often easier and less error-prone to use named arguments for these 
constructors:

Wx::Frame.new(nil, :title => 'Ruby Mud Client', :pos => [300, 875] )

The other values will get the defaults eg -1, DEFAULT_POSITION

a




More information about the wxruby-users mailing list