Skip to content

UpDown class ​

An UpDown is a small spin control --- a pair of up / down arrow buttons that adjust an internal Value by Increment on each click. Often paired with an external textbox or label to display the current value.

vb
Private Sub Form_Load()
    UpDown1.Min = 0
    UpDown1.Max = 100
    UpDown1.Increment = 5
    UpDown1.Value = 50
End Sub

Private Sub UpDown1_Change()
    Text1.Text = UpDown1.Value
End Sub

Private Sub Text1_Change()
    If IsNumeric(Text1.Text) Then UpDown1.Value = CLng(Text1.Text)
End Sub

The control inherits the focusable rect-dockable members from BaseControlFocusableNoFont --- size, position, Anchors, Dock, Appearance, MousePointer / MouseIcon, ToolTipText, DragMode / DragIcon, Drag, Refresh, SetFocus, TabIndex / TabStop, ZOrder, CausesValidation, VisualStyles, hWnd, HelpContextID / WhatsThisHelpID. UpDown does not have a Font property (the arrows are drawn by the OS theme).

No auto-buddy ​

Unlike the VB6-era Win32 msctls_updown32 control, this UpDown does not auto-attach to a "buddy" textbox --- there is no UDS_AUTOBUDDY style exposed. Pair the spin control with another control manually by handling Change, UpClick, and DownClick.

Three event flavors ​

Three events let the application observe spin interaction at different granularity:

  • Change fires whenever Value actually changes --- including programmatic assignments.
  • UpClick fires when the user clicks the up arrow and Value increases.
  • DownClick fires when the user clicks the down arrow and Value decreases.

Properties ​

Increment ​

The amount each click of the arrow buttons changes Value by. Long. Default: 1. Stored as the nInc field of a UDACCEL record applied via UDM_SETACCEL.

Max ​

The upper bound of the range. Long. Default: 10. Applied via UDM_SETRANGE32.

Min ​

The lower bound of the range. Long. Default: 0.

Orientation ​

The control's orientation. A OrientationConstants member (ccOrientationHorizontal or ccOrientationVertical). Default: ccOrientationHorizontal. Changing this property at run time recreates the underlying Win32 window.

ToolTipText ​

A tooltip string shown when the user hovers over the control. String. Inherited but re-exposed.

Value ​

The current spinner value. Long. The default member. Reads via UDM_GETPOS32, writes via UDM_SETPOS32. Fires Change when set programmatically. Clamped to [Min, Max].

VisualStyles ​

Whether the OS visual styles theme is applied. Boolean. Default: True. Inherited but re-exposed.

Events ​

Change ​

Raised when Value has changed by user interaction, by an arrow click, or by code.

Syntax: object_Change( )

DownClick ​

Raised when the user clicks the down arrow and Value is successfully decreased.

Syntax: object_DownClick( )

DragDrop, DragOver ​

Inherited drag-drop events.

GotFocus, LostFocus ​

Inherited focus events.

Initialize ​

Raised after the control's window has been created.

MouseDown, MouseMove, MouseUp ​

Inherited mouse events.

OLECompleteDrag, OLEDragDrop, OLEDragOver, OLEGiveFeedback, OLESetData, OLEStartDrag ​

Inherited OLE drag-and-drop events.

UpClick ​

Raised when the user clicks the up arrow and Value is successfully increased.

Syntax: object_UpClick( )

Validate ​

Inherited validation event.

See Also ​

twinBASIC and LOGO copyright of "WaynePhillipsEA" author