Initializing a Frame seems to fail


#1

/usr/bin/ruby -w /Users/Tim/wxrmc.rb
/Users/Tim/wxrmc.rb:9:in `new’: Error initializing #Wx::Frame:0x74ecf8
(ArgumentError)
: Wrong arguments for overloaded method ‘wxFrame.new’.
Possible C/C++ prototypes are:
wxFrame.new()
wxFrame.new(wxWindow *parent, wxWindowID id, wxString const &title,
wxPoint const &pos, wxSize const &size, long style, wxString const
&name)

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:inmain_loop’
from /Users/Tim/wxrmc.rb:21

Compilation exited abnormally with code 1 at Wed Jan 14 15:46:45

Thats the error for this line:
@frame = Frame.new(nil, -1, “Ruby Mud Client”, DEFAULT_POSITION,
Point.new(300, 875))
of this code:

http://pastie.org/360951

Anyone know what it means by ‘Wrong Arguments’? I’m fairly certain that
those arguments are correct…


#2

Tim M. wrote:

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


#3

Here is your problem

@frame = Frame.new(nil, -1, “Ruby Mud Client”, DEFAULT_POSITION,
Point.new(300, 875))

^^^^^^^^^^^^^^^^^^^

That actually needs to be Size.new(300,875), or you can just pass
[300,875],
and that will work as well.


#4

Mario S. wrote:

Here is your problem

@frame = Frame.new(nil, -1, “Ruby Mud Client”, DEFAULT_POSITION,
Point.new(300, 875))

^^^^^^^^^^^^^^^^^^^

That actually needs to be Size.new(300,875), or you can just pass
[300,875],
and that will work as well.

Hey, thanks you two! I thought that it only put in the Defaults for
things you dont specify, and you had to specify in order.


#5

Tim M. wrote:

Mario S. wrote:

Here is your problem

@frame = Frame.new(nil, -1, “Ruby Mud Client”, DEFAULT_POSITION,
Point.new(300, 875))

^^^^^^^^^^^^^^^^^^^

That actually needs to be Size.new(300,875), or you can just pass
[300,875],
and that will work as well.

Hey, thanks you two! I thought that it only put in the Defaults for
things you dont specify, and you had to specify in order.

Meep! Now it runs really slowly… Like the inputbar and textview don’t
even initialize…


#6

I am new to Ruby and WxRuby.

I am trying the sample code below:

require ‘wx’
include Wx

class MyFrame < Frame
def initialize()
super(nil, -1, ‘My Frame Title’)
end
end
app = MyFrame.new(‘New’)
app.main_loop

When I mouse over the line "super(nil, -1, ‘My Frame Title’) I am
getting the following error:

Found 1 extra argument(s). Required: 2, log)

I hope someone out there can help correct this error.

Thanks.


#7

This is after I had .shows for everything, mind you.