The scrollbar component is represented by the Scrollbar class. It is a subclass of Basescrollbar, which is a direct subclass of Basecomponent. The members of both Scrollbar and Basescrollbar are discussed here.
Table 11.5 shows the attributes of the Basescrollbar class and Table 11.6 presents the Scrollbar class’s attribute.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
axis | Tag only | string | y | final |
Description. The orientation of the scrollbar. Valid values are “x” and “y”. | ||||
focusview | Tag and JS | string | read-write | |
Description. The view the scrollbar must listen to for mousewheel activation events. If this attribute is not present, it will be set to the scrolltarget or the immediateparent of the scrollbar. | ||||
mousewheelactive | Tag and JS | boolean | false | read-only |
Description. Indicates whether or not the mousewheel is active for the focusview attribute. | ||||
mousewheelevent_off | Tag and JS | string | onblur | read-write |
Description. The event that deactivates the mousewhen when sent from the focusview. | ||||
mousewheelevent_on | Tag and JS | string | onfocus | read-write |
Description. The event that activates the mousewhen sent from the focusview. | ||||
pagesize | Tag only | number | final | |
Description. The maximum distance to scroll. The default value is the height or width of the scrollbar. | ||||
scrollable | Tag and JS | Boolean | true | read-only |
Description. Indicates whether or not the scroll target is bigger than the containing view. A value of true means that the scrollbar is active. | ||||
scrollattr | TAg only | string | final | |
Description. The attribute of the scrolltarget that is modified by the scrollbar. By default, it is the axis attribute. | ||||
scrollmax | Tag only | number | final | |
Description. The maximum distance to scroll. The default value is the same as the height of the scroll target (for a vertical scrollbar) and the width of the scroll target (for a horizontal scrollbar). | ||||
scrolltarget | Tag only | reference | final | |
Description. Theview that is controlled by the scrollbar. | ||||
stepsize | Tag and JS | number | 10 | read-write |
Description. The amount that the scrolltarget is moved when the user clicks on the scrolltrack or when the step metho is called. | ||||
usemousewheel | Tag and JS | boolean | true | read-write |
Description. Indicates whether or not the scrollbar listens for mousewheel events. |
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
disabledbgcolor | Tag and JS | number | read-write | |
Description. The scrollbar’s background color when it is disabled. If this attribute is not defined, the immediate parent’s background color is used. |
The Basescrollbar class adds two new methods:
page(n)
Page ahead (by passing 1) or back (by passing –1).
step(n)
Move ahead (by passing 1) or back (by passing –1).
The Scrollbar class does not define new methods.
The code in Listing 11.3 shows an LZX application that uses one vertical scrollbar and one horizontal scrollbar.
<canvas height="100"> <view name="main" width="100" height="100" clip="true"> <text multiline="true"> The OpenLaszlo Server is a Java servlet/JSP <br/> application. This server makes LZX application <br/> development process supereasy.<br/> You can compile your code by directing your Web<br/> browser to the OpenLaszlo server. The server <br/> examines the URL and compiles the appropriate <br/> source code (LZX file). <br/> It then sends the generated Flash file to the <br/> browser so that you can view your application. <br/> If the compilation fails, the server sends a <br/> compile error, telling you which line or lines <br/> of code are causing the error. <br/> If there is an error but compilation can continue, <br/> the server generates the Flash file and sends warning messages. </text> <scrollbar axis="y"/> <scrollbar axis="x"/> </view> </canvas> |
You can test the code in Listing 11.3 by going to this URL.
http://localhost:8080/lps-4.0.x/app11/scrollbarTest1.lzx
Figure 11.5 shows what you will see if you run the code in Listing 11.3.