ADDOBJECT objectId:license[, objectname[, xpos, ypos, width, height, parent]]
Description
ADDOBJECT attaches an object to a program. Once an object is attached, its properties can be queried and its methods can be executed from within the program. The required parameter, objectID, is a string expression that references the full name of an object from the registry, or the short name of the object. Table 4 below lists some common objects. If the control requires a license number, enter it after the objectID, separated by a colon. The optional parameter, objectname, is a string expression that must follow standard variable naming conventions. objectname is the variable that will be added to the program, to refer to the object. If no objectname is given objectID is used by default. The optional parameters xpos, ypos, width, and height, are numeric expressions that specify the default location and size of visual objects in pixels. The parent parameter makes the object a child of the object that is named: the new control will be placed on top of the parent.
The description of an object and its values are contained in its Properties. (See "Properties")
Objects may contain functions you can call from your program. (See "Methods")
Objects which are contained within NS Basic/CE itself are documented in this Handbook. NS Basic/CE also supports external objects, also known as ActiveX Controls. A number of these come with NS Basic/CE; others are available from third parties. They are documented in the Tech Notes under the Help menu.
Objectscansendeventsto your program by calling SUB procedures. The name of the procedure is a combination of the object nameandtheevent.An optional, comma-separated list of arguments may be included by someevents.Important:Ifanobjectsends events, you must always supply all 6 arguments. (See "Events")
SUB objectname_event(arglist)]
'Execute this when objectname gets event
END SUB
Table 4: Common Objects
|
Short Name |
Where it's documented |
|
ADO |
Data Base - Tech Note 03 |
|
CheckBox |
|
|
ComboBox |
In this document |
|
Comm |
Serial Comms - Tech Note 05 |
|
CommandButton |
In this document |
|
Date |
In this document |
|
Dialog |
Dialog boxes - Tech Note 04 |
|
File |
Simple File I/O - Tech Note 08 |
|
FileSystem |
Files and Dirs - Tech Note 09 |
|
Frame |
In this document |
|
Finance |
Money calculations - Tech Note 03 |
|
Grid |
Data Grid - Tech Note 10 |
|
HTMLView |
Html viewer – Tech Note 42 |
|
HScrollbar |
In this document |
|
Image |
Image holder - Tech Note 03 |
|
ImageList |
List of Images - Tech Note 11 |
|
Label |
In this document |
|
ListBox |
In this document |
|
ListView |
Display Items - Tech Note 12 |
|
OptionButton |
In this document |
|
Output |
In this document |
|
PictureBox |
Manipulate Pictures - Tech Note 13 |
|
TabStrip |
Tab object - Tech Note 17 |
|
TextBox |
In this document |
|
Time |
In this document |
|
TreeView |
|
|
TriButton |
In this document |
|
VScrollBar |
In this document |
|
WinSock |
Internet stuff - Tech Note 03 |
Example
REM ADDOBJECT adds an object to the program
ADDOBJECT "ThirdParty.Control:123-ghs","TPC"
ADDOBJECT "Finance", "Finance"
ADDOBJECT "PictureBox", "PBox", 65, 10, 55, 20
PBox.BorderStyle = 1
PBox.BackColor = vbWhite
PBox.DrawText " Button"
SUB PBox_Click()
PRINT FORMATCURRENCY(Finance.Pmt(.0058, _
180, 130000))
END SUB
Output
Related Items
Events, Methods, Properties, SET