[fxruby-users] setting widget attributes

Mark Volkmann r.mark.volkmann at gmail.com
Tue Mar 28 16:08:02 EST 2006


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".

--
R. Mark Volkmann
Object Computing, Inc.



More information about the fxruby-users mailing list