Label Ocx

Purpose

Creates an Ocx Label control in the current active form, window, or dialog.

Syntax

Ocx Label name = text$ [, id], x, y, b, h [, style%]

text$:control text
id%:control identifier
x, y, b, h:iexp
style%:the control styles

Description

A Label control is a graphical control you can use to display text that a user can't change directly.

You can write code that changes the text displayed by a Label control in response to events at run time. For example, if your application takes a few minutes to commit a change, you can display a processing-status message in a Label. You can also use a Label to identify a control, such as a TextBox control, that doesn't have its own Caption property.

You can define a character in the Caption property of the Label as an access key. When you define an access key in a Label control, the user can press and hold down ALT+ the character you designate to move the focus to the next control in the tab order.

Properties

Alignment | Appearance | BackColor | BorderStyle | Caption | Enabled | Font | FontBold | FontItalic | FontStrikethru | FontUnderline | FontName | FontSize | ForeColor | Height | HelpContextID | hWnd | Index | Left | MouseCursor | MouseIcon | MousePointer | MultiLine | Name | Parent | TabStop | Tag | Top | ToolTiptext | Transparent | Visible | WhatsThisHelpID | Width

Methods

HitTest | Move | Refresh | SetFont | TextHeight | TextWidth | ZOrder

Events

Click | MouseDown | MouseUp | MouseMove

Example

OpenW Hidden 1

With Win_1

.ScaleMode =   basTwips

.BackColor  = colBtnFace

.Caption   =   "Label & TextBox"

.Height    =   3900

.Left      =   60

.Top       =   345

.Width     =   4150

EndWith

Win_1.Show

OcxScale = 1

Ocx Label lb1 = "Lbl&1:", 360, 90, 2000, 375

Ocx TextBox Text1 = "Text1", 360, 480, 3135, 375

Ocx Label lb2 = "Lbl&2:", 360, 900, 2000, 375

Ocx TextBox Text2 = "Text2", 360, 1200, 3135, 375

Ocx Label lb3 = "Lbl&3:", 360, 1700, 2000, 375

Ocx TextBox Text3 = "Text3", 360, 2040, 3135, 375

Ocx Command cmdClear = "&Clear Fields", 360, 2880, 1455, 375

.Default         =   True

Ocx Command cmdQuit = "&Quit", 2160, 2880, 1095, 375

.Cancel          =   True

Text1.SetFocus

Do

Sleep

Until Me Is Nothing

 

Sub cmdQuit_Click

PostMessage Win_1.hWnd, WM_CLOSE, 0, 0

End Sub

 

Sub cmdClear_Click

ClearTextboxes(cmdClear.Parent)

End Sub

 

Sub ClearTextboxes(frm As Form)

Local EditField As Control

For Each EditField In frm.Controls

If TypeOf(EditField) Is TextBox Then

EditField.Text = ""

End If

Next

End Sub

See Also

Ocx, OcxOcx

Animation, CheckBox, ComboBox, Command, CommDlg, Form, Frame, Image, ImageList, ListBox, ListView, MonthView, Option, ProgressBar, RichEdit, Scroll, Slider, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown

{Created by Sjouke Hamstra; Last updated: 07/10/2017 by James Gaite}