ScrollBars, Scrolled

The ScrollBars property determines whether an edit box, form or grid displays a scrollbar. The Scrolled event fires each time the user clicks either the horizontal or vertical scrollbars, or drags either scroll button (the "thumb") on the grid or form. It also fires when the DoScroll method is called programmatically. The Scrolled event applies only to grids and forms, not to edit boxes.

Usage

oObject.ScrollBars = nScrollBar
nScrollBars = oObject.ScrollBars

Parameter

Value

Meaning

nScrollBar

0

None.

1

Horizontal bars only—grids and forms.

2

Vertical bars only.

3

Both horizontal and vertical bars—grids and forms only.


Scrollbars were added to Visual FoxPro forms in version 6.0, as part of the support for Active Documents. We greeted this capability with mixed feelings—it is always good to have a more flexible programming model, but some features are just too likely to be abused. We don't believe scrolling forms are a particularly good user interface, and strongly recommend you consider alternatives before settling on them. (We came across one piece of research that says only 10 percent of users scroll beyond the first screen of information on a Web page. It's stuff like that that makes us think scrollable forms don't belong in most applications.)On the other hand, we think data entry operators benefit from using a scrollable form that more accurately depicts the data entry form they are working from (say, a Form 1040). It's definitely preferable to learning different navigation for the form than for the paper document. Also, if managed correctly, tabbing down through a document, paging up and down, and moving top to bottom in a document with the document metaphor could make scrollbars appropriate for some applications. Since DoScroll doesn't work for forms (only grids), you'll need to consider some tricks with GotFocus() and SetViewPort(). Scrolling can be a tedious thing, and that's why we suspect most Web surfers aren't inclined to do so. Ensure that, if you decide to incorporate scrolling forms in your design, you make them easy to use from the keyboard as well as with a mouse.

VFP 7 Service Pack 1 fixes a bug in the original release of VFP 7 (but not previous versions of VFP): Scrollbars on edit boxes didn't show in an EXE running under the runtime libraries. A patch to fix this was released almost immediately after VFP 7 was; Service Pack 1 includes this fix, so if you haven't already installed the patch, there's no need to do so once you have SP1.


Usage

object.Scrolled()
Procedure object.Scrolled()
LPARAMETERS [ nIndex, ] [ nWhichWay ]

Parameter

Value

Meaning

nIndex

Integer

The index into this control, if used as part of a control array.

nWhichWay

0

User clicked the up arrow button or dragged the thumb upward.

1

User clicked the down arrow button or dragged the thumb downward.

2

User clicked in the space above the thumb.

3

User clicked in the space below the thumb.

4

User clicked the left arrow button or dragged the thumb to the left.

5

User clicked the right arrow or dragged the thumb to the right.

6

User clicked in the space to the left of the thumb.

7

User clicked in the space to the right of the thumb.


The Scrolled event gives you an opportunity to rearrange the display as the user scrolls from one part of a grid or form to another. We haven't found a whole bunch of uses for this event yet, but we're sure we'll find some good stuff.The directional feedback is confusing to a lot of people. The "arrow" values are returned if the user clicks on the buttons located at either end of the scrollbar, or if she grabs the "thumb" in the middle of the scrollbar and positions it where she wants it to be. We find it rather confusing that two very different physical events can't be distinguished this way. Even more confusing, you can change the magnitude of scrolling with the buttons, but not the precision of moving the thumb, by changing the "SmallChange" properties (does this mean we're getting nickeled and dimed? That this is a penny-ante feature? Let's change the subject�). The other four values are returned when the user clicks on the "background" of the scrollbar in order to move the thumb toward the position he clicked. Confusing as all this is, it is consistent, and it follows with the rest of the Windows scrolling window model.

Example

ThisForm.grdGrid1.Scrolled()

See Also

ContinuousScroll, DoScroll, EditBox, Form, Grid, HScrollSmallChange, ScaleMode, SetViewPort, ViewPortHeight, ViewPortLeft, ViewPortTop, ViewPortWidth, VScrollSmallChange


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .