Creates a control in the current active form, window, or dialog.
Control text$, id%, class$, x, y, w, h[, style%]
text$:control text
id%:control identifier
class$:class name
x,y,w,h:iexp
style%:the control styles
Control creates a program defined control window with width w% and height h% at coordinates specified in x% and y%. The window shows the text specified in text$ and can be referred to with the value specified in ID%. class$ specifies the class of the control elements which the control window can assign.
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
Control "", 1010, "msctls_updown32", _
UDS_ARROWKEYS | UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNLEFT | _
WS_TABSTOP, 10, 10, 100, 20
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
With the general Control statement any control type can be created.
AutoCheckBox, AnimateCtrl, 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: 09/05/2020 by James Gaite}