NewUpDown |
Description
Adds an updown control to a form. |
Syntax
[Set oCtl =] oFrm. NewUpDown |
( Name, Left, Top, Width, Height, [Orientation], [Container] ) |
Parameters
Part |
Description |
Set oCtl = |
(optional) Store a reference to the new control in the variable oCtl. This variable can be used to access the control's properties and methods |
oFrm |
A reference to a form object (see the NewForm method) |
Name |
The name of the control. It must be unique within the form and may not be empty or start with an asterisk (*) |
Left |
See the list of properties below |
Top |
See the list of properties below |
Width |
See the list of properties below |
Height |
See the list of properties below |
Orientation |
(optional) See the list of properties below |
Container |
(optional) The name of an existing frame control that will act as container for the progressbar. If unspecified or an empty string, the Form itself will be the container. Please note that the Left and Top properties are relative to the container's left and top edges |
Properties, Methods and Events
Property |
Description |
||
Alignment |
0 |
The control is aligned to the left of its buddy control |
|
1 |
The control is aligned to the right of its buddy control (default) |
||
Setting the Alignment property automatically realigns the UpDown control with its buddy control. The buddy control's width is reduced by the width of the UpDown control, so that the overall width of the two controls is the same as the buddy control was alone |
|||
AutoBuddy |
(boolean) Determines whether the UpDown control automatically uses a control as its buddy control, based on its tab order. When True the UpDown control uses the previous control in the tab order as its buddy control. If no controls with a previous tab index can be used as a buddy control, the first available control with a higher tab index is used. When False (default), the UpDown control uses the setting in the BuddyControl property |
||
BuddyControl |
Sets or returns the control used as the buddy control. You can implicitly set the BuddyControl property by setting AutoBuddy to True. In this case, the BuddyControl property is automatically set to the previous control in the tab order. Setting the BuddyControl property to Nothing automatically sets the AutoBuddy setting to False |
||
BuddyProperty |
Sets or returns the property used to synchronize the UpDown control with its buddy. If the SyncBuddy property is True, the control will synchronize its Value property with the property specified by BuddyProperty. |
||
Enabled |
(boolean) Determines if the control can respond to user-generated events |
||
Height |
The height of the control in twips |
||
Left |
The distance from the left edge of the specified container in twips |
||
Max |
The maximum value of the scroll range. This can be a negative number. |
||
Min |
The minimum value of the scroll range. This can be a negative number. |
||
Orientation |
0 |
(default) The arrow buttons are positioned vertically |
|
1 |
The arrow buttons are positioned horizontally |
||
Parent |
(read-only) Returns the parent form, object or collection. You can use the parent property to access the properties and methods of an object's parent |
||
SyncBuddy |
(boolean) When True, the control synchronizes its Value property with the property specified by the BuddyProperty property. If no BuddyProperty is specified, the default property for the buddy control is used. |
||
Tabstop |
(boolean) Determines whether the TAB key can be used to move the focus |
||
Tag |
(reserved) Used internally to store the user-defined controlname |
||
ToolTipText |
Explanatory text that appears in a small rectangle below the object when you pause the mouse pointer (hover) over it for about one second |
||
Top |
The distance from the top edge of the specified container in twips |
||
Value |
(long) Sets or returns the current position of the scroll value |
||
Visible |
(boolean) Determines whether the control is visible or hidden |
||
Width |
The width of the control in twips |
||
Wrap |
(boolean) Determines whether the Value property wraps around to the beginning or end once it reaches the Max or Min value. The default is False |
||
Method |
Description |
||
Move |
Parameters: left [, top [, width [, height ]]] |
||
Only the left argument is required. However, to specify any other arguments, you must specify all arguments that appear in the syntax before the argument you want to specify. For example, you can't specify width without specifying left and top. Any trailing arguments that are unspecified remain unchanged |
|||
Event |
Description |
Event raised |
|
Change |
Occurs whenever the Value property changes. The Value property can change through code, by clicking the arrow buttons, or by changing the value in a buddy control when the SyncBuddy property is True |
Controlname |
|
To be able to handle events you need to operate a form in callback mode. |
Example
Option Explicit Set oDlg = Wscript.CreateObject("WshDialog.Kit", "oDlg_") 'Add a new form and store a reference to it in the variable oFrm Set oFrm = oDlg.NewForm("Sample") 'Set the form's caption oFrm.Caption = "Testing the UpDown control" 'Add a label control and store a reference in the variable oLbl Set oLbl = oFrm.NewLabel("LBL1", 150, 150, 1000, 400, "0") oLbl.FontSize = 12 oLbl.FontBold = True oLbl.BorderStyle = 1 oLbl.Alignment = 2 'Add a vertical updown control and store a reference in oCtl Set oCtl = oFrm.NewUpDown("V-UPDOWN", 0, 0, 0, 0) oCtl.Min = 0 oCtl.Max = 100 oCtl.Wrap = True 'Link the updown control to the Caption property of the LBL1 control oCtl.BuddyControl = oLbl oCtl.BuddyProperty = "Caption" oCtl.SyncBuddy = True 'Add a textbox control and store a reference in the variable oTbx Set oTbx = oFrm.NewTextBox("TBX1", 1500, 150, 1000, 400, "0") oTbx.FontSize = 12 oTbx.FontBold = True oTbx.BorderStyle = 1 oTbx.Alignment = 2 'Add a horizontal updown control and store a reference in oCtl Set oCtl = oFrm.NewUpDown("H-UPDOWN", 0, 0, 0, 0, True) oCtl.Min = 0 oCtl.Max = 10 'Link the updown control to the Text property of the TBX1 control oCtl.BuddyControl = oTbx oCtl.BuddyProperty = "Text" oCtl.SyncBuddy = True 'Add an OK button and set it's Default Property Set oCtl = oFrm.NewButton("OK", 2750, 150, 1000, 400, "&OK") oCtl.Default = True 'Automatically size the form to the controls placed on it oFrm.AutoSize 'Show the form in the taskbar oFrm.TaskBar = True 'Show the form oFrm.Show vbModal 'Show the value of the updown controls sMsg = "The value of the Vertical Updown control is" sMsg = sMsg & vbTab & oFrm.Ctl("V-UPDOWN").Value & vbCrLf sMsg = sMsg & "The value of the Horizontal Updown control is" sMsg = sMsg & vbTab & oFrm.Ctl("H-UPDOWN").Value MsgBox sMsg |