Forum: Ruby foxGUIb GUI and code separation question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
67bb4df2775f6a6b603347dce7119571?d=identicon&s=25 unknown (Guest)
on 2006-05-28 11:03
(Received via mailing list)
While working through example 1 in the user's guide to foxGUIb,
I am running into problems when I try to separate GUI design and
code. Inches.rb is ok, but ExtendInches.rb  doesn't work (see  the
errors file).

I've attached the two files.
What am I doing wrong ?

Thanks in advance,

Best regards,

Axel
48d1aca7191f2d16e184971054c7c143?d=identicon&s=25 Meinrad Recheis (Guest)
on 2006-05-28 22:27
(Received via mailing list)
On 5/28/06, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
> Thanks in advance,
>
> Best regards,
>
> Axel
> ExtendInches.rb:17:in `initialize': wrong number of arguments (1 for 0)
> (ArgumentError)
>         from ExtendInches.rb:17
>

you get the error message because you try to instantiate an InchesX
object by calling an Inches constructor.

you are mixing "extending a class" with "deriving a subclass"

you can do both. either you extend a gui class like this:

class Inches
# ... foxguib generated code here
end

class Inches
  def init
    # ... your extension code here
  end
end

or you derive from the foxguib class which looks like this:

class DerivedInches < Inches
  def initialize parent
    super
    # ... your code here
  end
end

hope this helps,
-- henon
This topic is locked and can not be replied to.