Creates an UpDown common control in the current active form, window, or dialog.
UpDownCtrl text$, id%, x, y, w, h[, style%]
text$:control text
id%:control identifier
x,y,w,h:iexp
style%:the control styles
An UpDown control has a pair of arrow buttons which the user can click to increment or decrement a value, such as a scroll position or a value in an associated control, known as a buddy control.
The command creates a control without an OCX wrapper; so it and cannot be handled using properties, methods, and event subs. When used in a form the WM_COMMAND and WM_NOTIFY messages should be handled in the form's _MessageProc sub.
/* Styles for the UpDown Control
Global Enum UDS_WRAP = 1, _
UDS_SETBUDDYINT, UDS_ALIGNRIGHT=4, _
UDS_ALIGNLEFT=8, UDS_AUTOBUDDY=10, _
UDS_ARROWKEYS=$20, UDS_HORZ =$40, _
UDS_NOTHOUSANDS=$80, UDS_HOTTRACK =$100
/* Messages to Control the animation
Global Enum UDM_SETRANGE=WM_USER + 101, _
UDM_GETRANGE, UDM_SETPOS, UDM_GETPOS, _
UDM_SETBUDDY, UDM_GETBUDDY, UDM_SETACCEL, _
UDM_GETACCEL, UDM_SETBASE, UDM_GETBASE, _
UDM_SETRANGE32, UDM_GETRANGE32, _
UDM_SETUNICODEFORMAT=$2005, _
UDM_GETUNICODEFORMAT=$2006
OpenW 1
Ocx TextBox ed1 = "", 10, 10, 100, 20
ed1.Appearance = 1
UpDownCtrl"", 1010, 10, 10, 100, 20, _
UDS_ARROWKEYS | UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNLEFT | WS_TABSTOP
Local hUpDown As Handle = Dlg(Win_1.hWnd, 1010)
SendMessage hUpDown, UDM_SETBUDDY, ed1.hWnd, 0
SendMessage hUpDown, UDM_SETRANGE, 0, MakeLong(1000, 990)
SendMessage hUpDown, UDM_SETPOS, 0, MakeLong(0, 993)
~SetFocus(Dlg(Win_1.hWnd, 10))
Do
Sleep
Until Me Is Nothing
Sub Win_1_MessageProc(hWnd%, Mess%, wParam%, lParam%, retval%, ValidRet?)
Dim hdr As Pointer NMHDR
Switch Mess
Case WM_NOTIFY
Pointer(hdr) = lParam
EndSwitch
EndSub
Type NMHDR
hwndFrom As Long
idfrom As Long
code As Long
EndType
This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.
With the general Control statement any control type can be created.
Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl
{Created by Sjouke Hamstra; Last updated: 25/10/2014 by James Gaite}