<br><br><div class="gmail_quote">On Mon, Oct 27, 2008 at 12:53 PM, chen li <span dir="ltr"><<a href="mailto:chen_li3@yahoo.com">chen_li3@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I am new to FxRuby. I am learning it by studying some code samples. Now I am confused about a method call in the following script: which class defines method create, class FXApp or HelloWindow/FXMainWindow? Based on the code, class HelloWindow/FXMainWindow defines method 'create'. If this is true , the object from this class can response to the message. But here why does an object created by a different class FXApp response to method 'create'?<br>
</blockquote><div><br>Hello, Li -<br><br>Any class can have its own method create. Even Object has several create methods. In your sample, both HelloWindow and FXApp have methods named create. If you look at the docs on <a href="http://www.fxruby.org/doc/api/">http://www.fxruby.org/doc/api/</a>, you will see the method create, but you can't see its source code because it's just a call to the Fox Toolkit's create in compiled C++ code.<br>
<br>When looking at methods, if you don't see one defined, look to the next higher class in the inheritance. Sooner or later you'll find one, even if you have to go all the way up to object. Remember that the name 'create' is only a symbol referring to the function; it could have been FXApp::magicalAppPopper() and HelloWindow::magicalWindowpopper. <br>
<br>Also note how HelloWindow makes use of 'super' to get the behavior defined in FXMainWindow and then add some trimming to it.<br><br>HTH. <br><br>-- :D<br></div></div><br>