Export (0) Print
Expand All

© 1996 by Steven Holzner. All rights reserved.

Spin Buttons

Buy this book

Spin buttons look like two arrowheads, one pointing up and one down:


		/\
                   /    \
                   ------
                   \    /
                     \/

The user can click either the up or the down button; these controls are perfect for setting values that can be increased or decreased, such as volume. For example, if we give the spin button the ID SButton1, VBScript will call SButton1_SpinUp() if the user clicks the upper arrow, and SButton_SpinDown() if the user clicks the lower arrow. Let's add a spin button to our ActiveX control Web page, giving it the ID SButton1:

<HTML>
    <HEAD>
    <TITLE>OCX Control Page</TITLE>
    </HEAD>
    <BODY LANGUAGE = VBScript ONLOAD = "Page_Initialize">
    <CENTER>
    <H1>OCX Control Page</H1>
    </CENTER>
        .
        .
        .
    <!- Spinbutton>
    <PRE>
--> Spinbutton:  <OBJECT CLASSID="clsid:B16553C0-06DB-101B-85B2-0000C009BE81"
                HEIGHT=50 WIDTH=50 ID=SButton1></OBJECT>
    </PRE>
        .
        .
        .

If we want to catch button click events, we can put in subroutines such as SButton1_SpinUp:

<SCRIPT LANGUAGE = VBScript>
            Sub Page_Initialize
                  Cmd1.Caption = "Hello"
                  Frame1.Caption = "Frame"
                  Panel1.Caption = "Panel"
                  Grid1.Rows = 3
                  Grid1.Cols = 3
                  Grid1.Row = 1
                  Grid1.Col = 1
                  Grid1.Text = "5"
                  Graph1.GraphData = 2
                  Graph1.GraphData = 4
                  Graph1.GraphData = 5
                  Graph1.GraphData = 3
                  PBar1.Value = 50
            End Sub
-->         Sub SButton1_SpinUp
                .
                .
                .
-->         End Sub
    </SCRIPT>
    </BODY>
    </HTML>

Our spin button appears in Figure 6.4; we'll see more about spin buttons later. In the meantime, let's look into 3-D option buttons.

Figure 6.4  Spin buttons and more in our ActiveX page.

© 1996 by Steven Holzner. All rights reserved
Show:
© 2015 Microsoft