Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

UpClick, DownClick

These events fire when you click the little arrow characters in a spinner or when you use the arrow keys to change the spinner value. They also fire when you use the arrows to scroll the drop-down portion of a combo box. Despite documentation to the contrary in some versions, these events never fire for list boxes.

Usage

PROCEDURE oObject.UpClick
[LPARAMETERS nIndex]

PROCEDURE oObject.DownClick
[LPARAMETERS nIndex]

You only need to include the nIndex parameter when you’re dealing with a group of objects held in a control array. In that case, nIndex tells you which of those objects triggered the event.

Don’t get fooled about when these events fire. First, for combos, they fire not when you drop the combo open, but when the combo has more than DisplayCount items and you use the scroll bar in the drop-down portion. These events also don’t happen until you release the mouse button to complete the click. (This is in line with the timing of the Click event—we’ve got no complaints about it.) This means you could wind through dozens of values in the spinner or scroll the combo a long way before the UpClick or DownClick fires. If you need to take action as soon as the spinner’s value changes, use InteractiveChange instead. For combos, you’re out of luck—there’s nothing you can do until the user chooses a value.

Also, keep in mind that UpClick and DownClick don’t discriminate between the arrows on the spinner and the arrow keys. They fire in either case.

Example

* Give the user some feedback
PROCEDURE spnSpinner.UpClick
   WAIT WINDOW "You clicked the up arrow" NOWAIT
ENDPROC

See Also

ComboBox, DropDown, InteractiveChange, ListBox, Spinner