[fxruby-users] setting widget attributes

lyle at knology.net lyle at knology.net
Tue Mar 28 17:48:50 EST 2006


On Tue, 28 Mar 2006 15:14:35 -0600, "Mark Volkmann"
<r.mark.volkmann at gmail.com> wrote :

> Eeek!  This doesn't work. I'm so confused.
> 
> Is visibleRows an instance variable of FXTable?
> If so, why can't I access it directly from a subclass with "@visibleRows"?

No, @visibleRows is not a real instance variable for FXTable. That value is
buried way down deep in the C++ object.

> Does it have accessor methods?

Yes, but they are more along the lines of what Dave and Andy called "virtual
attributes". See the "Classes, Objects and Variables" chapter of Programming
Ruby (http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_classes.html),
and look at the section called "Virtual Attributes".

> If so, why can't I invoke them directly from a subclass
> without using "self."?

As I've noted in other replies, this is just how Ruby works. There is some
discussion of this in Programming Ruby as well; see the sidebar titled
"Using Accessors Within a Class" in the "Expressions" chapter
(http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html).


More information about the fxruby-users mailing list