How does a scrollbar get a name?
Sarah Reichelt
sarah.reichelt at gmail.com
Tue Dec 6 18:36:41 EST 2005
> I'm sure this is a dumb question, but in the RR docs one sees
> references to scrollbars, as in this example from the article on the
> scrollbar object:
>
> > set the style of scrollbar "Progress" to progress
> > if the thumbPosition of scrollbar "Level" > 400 then doOverflow
> >
> This indicates that scrollbars have names: now, if I have a common or
> garden scrolling field, say "myField", with an active scrollbar
> (let's say a vertical one), what is its name? It doesn't seem to be
> "myField", and I don't know how to refer to it or even see it in the
> Object Inspector in the IDE. I ask because I want to do things like
> scroll down to the end by scripting (which curiously enough I've
> never done before) and it seems that the first step is addressing the
> scrollbar.
A named scrollbar is a separate object. If you look at the tools
palette, below the various menu buttons, you will see 4 deifferent
styles of scrollbar / progress bar / slider etc which are all really
scroll bars. The scroll bar which are part of a field are not the
same, they do not have a name and cannot be controlled directly.
> Even more dumbly, maybe someone can point me at a document which
> explains how to make sure the last line of a scrolling field is
> always visible (i.e. the thumb position is always at the bottom of
> the scrollbar). I have a horrible feeling everyone knows this except me.
>
A field's scroll bars can be positioned using the field's vScroll and
hScroll properties. vScroll controls the vertical and hScroll controls
the horizontal. To set the scroll to a particular line, use:
set the vScroll of fld "MyField" to tLineNum * the effective
textHeight of fld "MyField"
To scroll directly to the bottom, the easiest way is just to scroll to
a very large number e.g.
set the vScroll of fld "MyField" to 10000
HTH,
Sarah
P.S. They are not dumb questions. The only dumb questions are the ones
that don't get asked :-)
More information about the use-livecode
mailing list