Left
Horizontal position in device-independent points, relative to the parent container.
Range: -100000 to 100000.
Accept editable text, react to changes and guide input with validation and focus.
The name belongs in txtName.Text; the result belongs in lblGreeting.Caption. A Click handler is the bridge between them. Trimming before testing length rejects whitespace-only input. The details window has its own public DisplayName field: set that value before calling Show so its Shown handler can render it.
Add TextBox to its intended parent and name it txtName for this example:
| Property | Example value |
|---|---|
Text | "" |
Use the full lesson for the owner’s initialization code and its complete layout.
Contract defaults are shown below. Where a new control has a different Designer starting value, that value is listed separately.
LeftHorizontal position in device-independent points, relative to the parent container.
Range: -100000 to 100000.
TopVertical position in device-independent points, relative to the parent container.
Range: -100000 to 100000.
WidthControl width in device-independent points.
Range: 0 to 100000.
Designer starting value: 140.
HeightControl height in device-independent points.
Range: 0 to 100000.
MinWidthMinimum control width in device-independent points; 0 lets the parent layout choose.
Range: 0 to 100000.
MinHeightMinimum control height in device-independent points; 0 lets the parent layout choose.
Range: 0 to 100000.
MaxWidthMaximum control width in device-independent points.
Range: 0 to 100000.
MaxHeightMaximum control height in device-independent points.
Range: 0 to 100000.
TabIndexKeyboard navigation order within the parent container; lower values come first.
Range: 0 to 100000.
ZIndexStacking order among sibling controls; larger values appear in front. Equal values preserve document order.
Range: -100000 to 100000.
AnchorEdges kept at their authored distance when the parent resizes. Use a comma-separated combination of Left, Top, Right and Bottom; Dock overrides the effective anchor without deleting it.
DockAutomatic placement within the parent: None, Left, Top, Right, Bottom or Fill. Dock overrides effective Anchor layout without deleting the stored anchors.
VisibleWhether the control is shown in the running application.
EnabledWhether the control accepts user interaction in the running application.
HitTestVisibleWhether the running control participates in pointer hit testing. The control remains selectable in the Designer.
AllowDropWhether this running control accepts application drag-and-drop operations; Designer movement is separate.
DragModeVB control drag: 0 Manual (code starts a drag with the Drag method) or 1 Automatic (a left-button press starts a drag, and the control raises no Click, MouseDown or MouseUp for that press).
Range: 0 to 1.
DragIconCase-insensitive name of a declared project image resource shown under the pointer while this control is dragged; empty shows a grey outline of the control.
TextInitial TextBox content. MultiLine determines whether runtime input accepts Return.
FontFont as Family|Size or Family|Size|Regular/Bold|Normal/Italic, size 6–96 DIP. Empty uses the theme font; System uses the theme family.
ForeColorText color as #RRGGBB. Empty uses the current macOS theme color.
BackColorBackground color as #RRGGBB. Empty uses the current macOS theme color.
MarginExternal spacing as one non-negative DIP value or Left,Top,Right,Bottom.
CursorPointer shown over the control: Default, Arrow, Hand, IBeam, Cross, Wait, Help, SizeAll, SizeNS, SizeWE, SizeNWSE, SizeNESW or NotAllowed.
OpacityVisual opacity from 0 (transparent) to 1 (opaque).
Range: 0 to 1.
DesignLockedPrevents movement and resizing in the Designer without changing runtime interaction.
AccessibleDescriptionAdditional help text announced by assistive technology.
AutomationIdStable automation identifier; empty uses the component Name.
PlaceholderHint shown while Text is empty.
AlignmentHorizontal text alignment: Left, Center or Right.
TabStopWhether Tab navigation can move focus to this TextBox.
ToolTipTextHelp text shown when the pointer rests over the running control; empty disables the tooltip.
TagApplication-defined text associated with this control; McBasic™ does not interpret it.
AccessibleNameName announced for this TextBox by assistive technology. Empty uses the control name.
AccessibleRoleAccessibility role override. Auto preserves the native semantic role; explicit values use the corresponding platform automation role.
ReadOnlyPrevents user changes to Text while allowing selection and copying.
MultiLineAllows multiple lines and Return in the running TextBox.
WordWrapWraps text to the available width in a multiline TextBox.
RequiredReports whitespace-only Text as invalid; does not discard input.
MaxLengthMaximum input length in UTF-16 code units; 0 means unlimited. Programmatic Text remains inspectable through IsValid and ValidationError.
Range: 0 to 100000.
ScrollBarsScroll bars of a MultiLine TextBox: None, Horizontal, Vertical or Both. An enabled bar appears only when the text overflows; a disabled axis still scrolls with the caret. Ignored when MultiLine is False.
CharacterCasingNormal keeps the text as typed; Upper or Lower converts typed, pasted and code-set text, as UCase or LCase do.
LockedRun-time alias of ReadOnly (VB6 name). macOS draws a read-only TextBox like an editable one, so the two are the same property.
SelStartRun time only: zero-based start of the selection in UTF-16 units; setting it moves the caret and clears the selection.
Range: 0 to 100000.
SelLengthRun time only: length of the selection in UTF-16 units, from SelStart.
Range: 0 to 100000.
SelTextRun time only: the selected text; assigning replaces the selection.
IndexPosition of this control in its control array, 0 to 32767. Several controls share one name only when every one of them has an Index. Absent from the layout, and -1 in code, when the control is not in an array.
Designer values: 0 to 32767. Clear the dedicated Index row for a non-array control; BASIC then reads -1.
Replace control with the object’s Name when creating a handler. ByRef arguments may be changed by your handler; ByVal arguments report an input value.
Occurs after the component value changes according to its McBasic™ change policy.
Private Sub control_Change()No parameters.
Occurs when runtime drag data enters this control; set Effect to Copy, Move, Link or None.
Private Sub control_DragEnter(ByVal Data As DragData, ByRef Effect As DragEffect, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Data | DragData | ByVal |
Effect | DragEffect | ByRef |
X | Double | ByVal |
Y | Double | ByVal |
Occurs while runtime drag data moves over this control; Effect may be updated for the current position.
Private Sub control_DragOver(ByVal Data As DragData, ByRef Effect As DragEffect, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Data | DragData | ByVal |
Effect | DragEffect | ByRef |
X | Double | ByVal |
Y | Double | ByVal |
Occurs while a control dragged inside the app (DragMode or the Drag method) moves over this control: State is 0 when it enters, 2 while it moves over and 1 when it leaves; Source is the dragged control and X, Y are local DIP coordinates.
Private Sub control_DragOver(ByVal Source As Control, ByVal X As Single, ByVal Y As Single, ByVal State As Integer)| Parameter | Type | Direction |
|---|---|---|
Source | Control | ByVal |
X | Single | ByVal |
Y | Single | ByVal |
State | Integer | ByVal |
Occurs when runtime drag data leaves this control without a drop.
Private Sub control_DragLeave()No parameters.
Occurs when runtime drag data is dropped on this control with a stable McBasic™ effect and local DIP coordinates.
Private Sub control_Drop(ByVal Data As DragData, ByVal Effect As DragEffect, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Data | DragData | ByVal |
Effect | DragEffect | ByVal |
X | Double | ByVal |
Y | Double | ByVal |
Occurs when a control dragged inside the app (DragMode or the Drag method) is released over this control; Source is the dragged control and X, Y are local DIP coordinates.
Private Sub control_DragDrop(ByVal Source As Control, ByVal X As Single, ByVal Y As Single)| Parameter | Type | Direction |
|---|---|---|
Source | Control | ByVal |
X | Single | ByVal |
Y | Single | ByVal |
Occurs when a pointing-device button is pressed over this control; Button is stable McBasic™ identity and X/Y are control-local DIP coordinates.
Private Sub control_MouseDown(ByVal Button As MouseButton, ByVal Shift As KeyModifiers, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Button | MouseButton | ByVal |
Shift | KeyModifiers | ByVal |
X | Double | ByVal |
Y | Double | ByVal |
Occurs when a pointing-device button is released for this control; Button is stable McBasic™ identity and X/Y are control-local DIP coordinates.
Private Sub control_MouseUp(ByVal Button As MouseButton, ByVal Shift As KeyModifiers, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Button | MouseButton | ByVal |
Shift | KeyModifiers | ByVal |
X | Double | ByVal |
Y | Double | ByVal |
Occurs when the pointer moves over the logical McBasic™ control; Button contains the currently held buttons and X/Y are local DIP coordinates.
Private Sub control_MouseMove(ByVal Button As MouseButtons, ByVal Shift As KeyModifiers, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Button | MouseButtons | ByVal |
Shift | KeyModifiers | ByVal |
X | Double | ByVal |
Y | Double | ByVal |
Occurs once when the pointer enters the effective bounds of the logical McBasic™ control.
Private Sub control_MouseEnter()No parameters.
Occurs once when the pointer leaves the effective bounds of the logical McBasic™ control.
Private Sub control_MouseLeave()No parameters.
Occurs for normalized pointer-wheel input; Delta is portable, and X/Y are local DIP coordinates.
Private Sub control_MouseWheel(ByVal Delta As Double, ByVal Shift As KeyModifiers, ByVal X As Double, ByVal Y As Double)| Parameter | Type | Direction |
|---|---|---|
Delta | Double | ByVal |
Shift | KeyModifiers | ByVal |
X | Double | ByVal |
Y | Double | ByVal |
Occurs when native system timing recognizes a primary-button double activation on the same logical McBasic™ control.
Private Sub control_DoubleClick()No parameters.
Occurs once when the TextBox receives effective keyboard focus.
Private Sub control_GotFocus()No parameters.
Occurs once when the TextBox loses effective keyboard focus.
Private Sub control_LostFocus()No parameters.
Occurs when a physical key is pressed while this control owns effective keyboard focus; setting Handled suppresses normal processing.
Private Sub control_KeyDown(ByVal KeyCode As KeyCode, ByVal Shift As KeyModifiers, ByRef Handled As Boolean)| Parameter | Type | Direction |
|---|---|---|
KeyCode | KeyCode | ByVal |
Shift | KeyModifiers | ByVal |
Handled | Boolean | ByRef |
Occurs for committed Unicode text input; set Handled to suppress the control default.
Private Sub control_KeyPress(ByVal Character As String, ByRef Handled As Boolean)| Parameter | Type | Direction |
|---|---|---|
Character | String | ByVal |
Handled | Boolean | ByRef |
Occurs when a physical key is released while this control owns effective keyboard focus; setting Handled suppresses normal processing.
Private Sub control_KeyUp(ByVal KeyCode As KeyCode, ByVal Shift As KeyModifiers, ByRef Handled As Boolean)| Parameter | Type | Direction |
|---|---|---|
KeyCode | KeyCode | ByVal |
Shift | KeyModifiers | ByVal |
Handled | Boolean | ByRef |
Sub SetFocus()Call on your instance: txtName.SetFocus.
Sub SelectAll()Call on your instance: txtName.SelectAll.
20f4bfed6b · Build manifest