# Initializing a Frame seems to fail

**URL:** <https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749>\
**Category:** wxRuby\
**Created:** [January 14, 2009, 11:53pm UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749 "2009-01-14T23:53:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 14, 2009, 11:53pm UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/1 "2009-01-14T23:53:22Z")

</div>

/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:in `main\_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](http://pastie.org/360951)

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

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 15, 2009, 12:39am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/2 "2009-01-15T00:39:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 15, 2009, 12:41am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/3 "2009-01-15T00:41:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 15, 2009, 12:45am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/4 "2009-01-15T00:45:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 15, 2009, 12:47am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/5 "2009-01-15T00:47:46Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 2, 2014, 9:49am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/6 "2014-09-02T09:49:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [January 15, 2009, 12:51am UTC](https://www.ruby-forum.com/t/initializing-a-frame-seems-to-fail/157749/7 "2009-01-15T00:51:22Z")

</div>

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