ScrollBar

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.

Table 11.5. The attributes of the Basescrollbar class
NameUsageTypeDefaultAccessibility
axisTag onlystringyfinal
 Description. The orientation of the scrollbar. Valid values are “x” and “y”.
focusviewTag and JSstring 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.
mousewheelactiveTag and JSbooleanfalseread-only
 Description. Indicates whether or not the mousewheel is active for the focusview attribute.
mousewheelevent_offTag and JSstringonblurread-write
 Description. The event that deactivates the mousewhen when sent from the focusview.
mousewheelevent_onTag and JSstringonfocusread-write
 Description. The event that activates the mousewhen sent from the focusview.
pagesizeTag onlynumber final
 Description. The maximum distance to scroll. The default value is the height or width of the scrollbar.
scrollableTag and JSBooleantrueread-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.
scrollattrTAg onlystring final
 Description. The attribute of the scrolltarget that is modified by the scrollbar. By default, it is the axis attribute.
scrollmaxTag onlynumber 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).
scrolltargetTag onlyreference final
 Description. Theview that is controlled by the scrollbar.
stepsizeTag and JSnumber10read-write
 Description. The amount that the scrolltarget is moved when the user clicks on the scrolltrack or when the step metho is called.
usemousewheelTag and JSbooleantrueread-write
 Description. Indicates whether or not the scrollbar listens for mousewheel events.

Table 11.6. The attribute of the Scrollbar class
NameUsageTypeDefaultAccessibility
disabledbgcolorTag and JSnumber 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.

Listing 11.3. Using scrollbars
<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.

Figure 11.5. The scrollabar


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset