Eigenschappen en methoden (API)

From Apache OpenOffice Wiki
< NL‎ | Documentation‎ | BASIC Guide
Revision as of 12:56, 28 January 2013 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Book.png

Een object in Apache OpenOffice BASIC verschaft een scala aan eigenschappen en methoden die kunnen worden aangeroepen door middel van het object.

Eigenschappen

Eigenschappen zijn als de eigenschappen van een object; bijvoorbeeld: Filename en Title voor een object Document.

De eigenschappen worden ingesteld door middel van een eenvoudige toewijzing:

Document.Title = "OpenOffice.org BASIC Programmeursgids"
Document.Filename = "basgids.odt"

Een eigenschap, net zoals een variabele, heeft een type dat definieert welke waarde het kan opnemen. De vorengenoemde eigenschappen Filename en Title zijn van het type tekenreeks (String).


Real Properties and Imitated Properties

Most of the properties of an object in Apache OpenOffice Basic are defined as such in the UNO description of the service. In addition to these "real" properties, there are also properties in Apache OpenOffice 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 Apache OpenOffice 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).
Personal tools