-
Notifications
You must be signed in to change notification settings - Fork 2
Properties
A property is an attribute of an object. Objects, such as controls, can have any number of attributes which can be set by using the appropriate property. For example, the TextBox control has a Text property that allows the TextBox to be populated.
Properties are accessed using dot notation, as shown in the example below, which sets the text property of the Text1 object to the string, Hello World!:
Text1.text = "Hello World!"Properties can also be used on the other side of the equal sign. For example, the contents of a TextBox can be loaded into a variable for further processing:
Dim strMyText as String = Text1.textJustifies the part of the CheckBox or RadioButton the user interacts with to the right or left of the caption text.
Note: The CheckBox and RadioButton only support the values for Left and Right. Assigning a value of Center will cause the control to be set to Left justification.
There are four anchor properties, Left, Top, Right, and Bottom. Anchors the object to one or more of the container boundaries. For example, anchoring an object to the bottom and right will cause the object to remain the same distance from the bottom and right of the container as the container is resized.
Note: The Anchors property must be set using the properties window on the form builder page. It is read-only in code at runtime.
Gets and sets the appearance of the object. There are two possible values, vbAppear3d and vbAppearFlat.
Gets and sets the backcolor or foreground color property. The background and foreground colors can be set in the form property window or at runtime by using the RGB function. For example, to set the background color of an object with the name "object", the following code could be used:
object.backgroundcolor = rgb(255,0,0) will set the background color to red.
Gets and sets the caption text. The caption is the text that is displayed on the control
Gets and sets the Dock property. The object can be undocked, docked against any one container edge, or set to fill the entire container. There are six potential values for the Dock property: VBDockNone, VBDockLeft, VBDockTop, VBDockRight, VBDockBottom, and VBDockFill.
Gets and sets the Enabled property. The Enabled property enables or disables the object. Disabling the object keeps the object visible but disables it and usually turns it grey.
The FontBold, FontItalic, FontStrikethru, FontUnderline properties are all read/write at runtime and turn the various font effects on or off.
Gets and sets the height or width, in pixels, of the object.
Double
Gets and sets the left or top position of the object, relative to the container, in pixels.
MousePointerConstant property. Gets and sets the look of the mouse pointer when the mouse is over the object.
The Name property is a unique name that identifies the object to the owner of the object. Names for Forms must be unique across the entire application. Names for controls must be unique within the form (class). The name is used to an object when invoking methods and properties, as shown in the code below in which the Text property for an object named "Text1" is being set to the string, "Hello World".
Text1.Text = "Hello World"Gets or sets the order in which each object receives focus when the tab key is pressed.
Gets or sets the TabStop property, which causes the focus to stop on the control when the tab button is pressed and the object's TabIndex is the next in line. Setting this property to False will cause the object to be skipped when the tab key is pressed to move to the next object.
Gets or sets the tag property. The tag property can be used to store program specific data. It is not used by twinBASIC and is not visible to the end user.
Gets or sets the visible property. Setting the property to True will make the object appear on the screen. Setting it to false will force it to not be shown.
Indicates whether the control will be drawn reflecting the current Windows OS theme.
We probably need an image example on that one.