[fxruby-users] setting widget attributes
meinrad.recheis at gmail.com
Tue Mar 28 17:46:50 EST 2006
On 3/28/06, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> On 3/28/06, Lyle Johnson <lyle at knology.net> wrote:
> > On Mar 28, 2006, at 1:32 PM, Mark Volkmann wrote:
> > > However, if I do this
> > >
> > > self.visibleRows = 5
> > >
> > > then it does.
> > >
> > > Shouldn't it work without "self."?
> > Nope, and this is a Ruby thing (not particular to FXRuby, I mean). When
> > you do:
> > visibleRows = 5
> > Ruby assumes that you're initializing a local variable. You only invoke
> > the accessor method for the visibleRows attribute when you prepend it
> > with self (as you've discovered).
> Since visibleRows is listed as an RW "attribute" in the RDoc, I
> thought that implied there were methods named "visibleRows" and
> visibleRows=" available. That's what I thought I was invoking with
> "visibleRows = 5". If those methods existed then Ruby wouldn't have
> thought I wanted to initialize a local variable. Right?
> Since those accessor methods don't exist, I'll just use "@visibleRows = 5".
that won't work ;)
all attributes are accessible via methods only. there are no instance
variables (with some exceptions) because the attributes have to be
passed to the underlying C++ library.
More information about the fxruby-users