[fxruby-users] method call question

chen li chen_li3 at yahoo.com
Thu Oct 30 12:30:56 EDT 2008

Hi everyone,

Thank all for the explanations.

I read all the feedbacks,go back and read Lyle's the book about Fxruby again. Then I add some lines to find out 1) object and its corresponding class
2) class and its corresponding superclass(up to final superclass).

Here are what I find:

app object is created by class FXApp and its parent class is FXObject.
hello object is created by class HelloWindow and its parent class is FXMainWindow.
The final parent for class HelloWindow  is FXObject(by repeating calling method superclass 6-7 times. I call all the parents in this chain as one of parent chain). And class FXApp never appears in the parernt chain. 

Here is my conclusion:
1) the relationship between class FXApp and  HelloWindow/FXMainWindow is horizontal or brother/sister. Their final parent is class FXObject(whose final parent should be class Object.) The point here is that in line app.create(),app objcet REALLY receives message of create() defined by its corresponding class FXApp but not by create() defined by class HelloWindow/FXMainWindow. There is no inherence issues between class FXApp and class HelloWindow/FXMainWindow.

2) But what really happens after app.create() is excuted: it causes #create() defined by each widget to be called(HelloWindow widget in this case). This is why class HelloWindow/FXMainWindow has to define #create() in its class. This might be called window hierarchy but it is NOT class inherence in Ruby. If I understand correctly it looks like it is a design  strategy for FxRuby: client object and server  resource... I guess this is what Lyle mentions how Rxruby works on page 90 in chapter 7.



More information about the fxruby-users mailing list