Difference between revisions of "EN/documentation/basic guide/properties and methods api"

From Wiki
Jump to navigationJump to search
(Основной текст)
 
 
(No difference)

Latest revision as of 17:02, 2 September 2011




An object in OpenOffice.org Basic provides a range of properties and methods which can be called by means of the object.

Properties

Properties are like the properties of an object; for example, Filename and Title for a Document object.

The properties are set by means of a simple assignment:

Document.Title = "OpenOffice.org Basic Programmer's Guide"
Document.Filename = "basguide.odt"

A property, just like a normal variable, has a type that defines which values it can record. The preceding Filename and Title properties are of the string type.

Real Properties and Imitated Properties

Most of the properties of an object in OpenOffice.org Basic are defined as such in the UNO description of the service. In addition to these "real" properties, there are also properties in OpenOffice.org Basic which consist of two methods at the UNO level. One of these is used to query the value of the property and the other is issued to set it (get and set methods). The property has been virtually imitated from two methods. Character objects in UNO, for example, provide the getPosition and setPosition methods through which the associated key point can be called up and changed. The OpenOffice.org Basic programmer can access the values through the Position property. Regardless of this, the original methods are also available (in our example, getPosition and setPosition).

Methods

Methods can be understood as functions that relate directly to an object and through which this object is called. The preceding Document object could, for example, provide a Save method, which can be called as follows:

Document.Save()

Methods, just like functions, may contain parameters and return values. The syntax of such method calls is oriented towards classic functions. The following call also specifies the True parameter for the document object when requesting the Save method.

Ok = Document.Save(True)

Once the method has been completed, Save saves a return value in the Ok variable.


Content on this page is licensed under the Public Documentation License (PDL).