Class DataRef() Foundation
Class function of the DataRef class.
The exclusive purpose of objects of the DataRef class is to reference data. Many Xbase Parts are derived from this class and the XbpWindow class. Since it has a visual representation and can access data, an Xbase Part is derived from XbpWindow as well as from DataRef. An Xbase Part can then manage both the screen display and the data.
The DataRef class provides services for other classes and is only significant in relation to other classes. A DataRef object is useless by itself. The service of a DataRef object is to reference data which is stored in variables (field variables or memory variables). This includes reading, assigning values to variables, data validation and the ability to undo changes made to the data.
The most important methods of a DataRef object are :setData() and :getData(). These two methods are used to define the current value in an Xbase Part edit buffer or to read the value and assign it to a variable. In this discussion of the DataRef class, the XbpSLE class is used to illustrate the DataRef class. The edit buffer of the XbpSLE object is set and read using :setData() and :getData(). The XbpSLE class is derived from DataRef and consequently these two methods also exist for XbpSLE objects. This can be shown in the following program code:
This program code illustrates the use of the methods :setData() and :getData(). :setData() is used to pass data to the Xbase Part and :getData() is later used to read the data. In the meantime, data is processed by the user within the event loop.
In the example, an argument (the memory variable cText) is passed to the method :setData() and the return value of :getData() is assigned to the variable cText. This process can be automated by assigning a code block for data handling to the instance variable :dataLink:
In this modified example, the data is passed between the memory variable and the Xbase Part using the data code block assigned to the instance variable :dataLink. When :dataLink contains a code block, this code block is evaluated by the method :setData() with no arguments. The value of the variable (the return value of the code block) is then sent to the Xbase Part. In the example, the value of cText is copied into the edit buffer of the input field oSLE. When :getData() is called, the current value of the Xbase Part is passed to the code block. The code block contained in :dataLink assigns the value to a variable referenced by the code block.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.