XUL Programmer's Reference Manual

<scrollbox>

Attributes Common Children
align <box>
valign <menu>
class <button>
id <text>
flex <image> 
width  
height  
autostretch  
orient  
oncommand  
observes (OR) <observes>
equalsize  
scrollByLine  
scrollByIndex  
scrollToLine  
getPosition  

 

<scrollbox> is a special box widget that acts like a XUL viewer element with its in-line content. In other words, when the XUL content in a scrollbox is larger than the scrollbox itself, that content is either clipped, or the scrollbox can provide scrollbars for seeing all of that content. In either case, the size of the scrollbox and its content are independent of one another.

In the following example, the scrollbox contains XUL widgets that get clipped when they are loaded in the browser:

<scrollbox width="200" height="200">
  <button width="150" value="bigbutton" />
  <button width="150" value="otherbutton" />
</scrollbox>
scrollByLine
Description
The scrollByLine method allows you to programmatically scroll by the input number of lines.
Syntax
<scrollbar id="string" ScrollByLine(delta_lines) />


Example

<scrollbar id="roll" ScrollByLines(5) />


Notes

Size of lines is based on the current font.
 
scrollByIndex
Description
The scrollByIndex method allows you to scroll based on the size of the children in the scrollbox.
Syntax
<scrollbar id="string" ScrollByIndex(delta_indexes) />


Example

<scrollbar ScrollTo(-1) />


Notes

The paramater delta_indexes represents the number of times to scroll by the total size of the scrollbar children. In the example above, the method scrolls back one full "screen."
 
scrollToLine
Description
The scrollToLine method allows you to scroll to a particular line
Syntax
<scrollbox scrollToLine(line) >


Example

<scrollbox scrollToLine(45) >


Notes

None.
 
getPosition
Description
The getPosition method returns the scroll offset in pixels.
Syntax
pos = scrollbox.getPosition


Example

<scrollbox>
  <button onclick="alert(parent.getPosition)" >


Notes

None.
 
Last updated: 1/11/01 Ian Oeschger