Obtains data from a control.
To obtain |
Use |
---|---|
The value of a data point in a series in a graph |
|
The unformatted data from an EditMask control |
|
Data from an OLE server |
Gets the value of a data point in a series in a graph.
Graph controls in windows and user objects, and graphs in DataWindow controls
controlname.GetData ( { graphcontrol, } seriesnumber, datapoint {, datatype } )
Argument |
Description |
---|---|
controlname |
The name of the graph from which you want data, or the name of the DataWindow control containing the graph. |
graphcontrol (DataWindow control only) |
(Optional) A string whose value is the name of the graph from which you want the data when controlname is a DataWindow. |
seriesnumber |
The number that identifies the series from which you want data. |
datapoint |
The number of the data point for which you want the value. |
datatype (scatter graph only) |
(Optional) A value of the grDataType enumerated datatype specifying whether you want the x or y value of the data point in a scatter graph. Values are:
|
Double. Returns the value of the data in datapoint if it succeeds and 0 if an error occurs. If any argument’s value is null, GetData returns null.
You can use GetData only for graphs whose values axis is numeric. For graphs with other types of values axes, use the GetDataValue function instead.
These statements obtain the data value of data point 3 in the series named Costs in the graph gr_computers in the DataWindow control dw_equipment:
integer SeriesNbr
double data_value
// Get the number of the series.
SeriesNbr = &
dw_equipment.FindSeries("gr_computers", "Costs")
data_value = dw_equipment.GetData( &
"gr_computers" , SeriesNbr, 3)
These statements obtain the data value of the data point under the mouse pointer in the graph gr_prod_data and store it in data_value:
integer SeriesNbr, ItemNbr
double data_value
grObjectType MouseHit
MouseHit = &
gr_prod_data.ObjectAtPointer(SeriesNbr, ItemNbr)
IF MouseHit = TypeSeries! THEN
data_value = &
gr_prod_data.GetData(SeriesNbr, ItemNbr)
END IF
These statements obtain the x value of the data point in the scatter graph gr_sales_yr and store it in data_value:
integer SeriesNbr, ItemNbr
double data_value
gr_product_data.ObjectAtPointer(SeriesNbr, ItemNbr)
data_value = &
gr_sales_yr.GetData(SeriesNbr, ItemNbr, xValue!)
Gets the unformatted text from an EditMask control.
EditMask controls
editmaskname.GetData ( datavariable )
Argument |
Description |
---|---|
editmaskname |
The name of the EditMask control containing the data. |
datavariable |
A variable to which GetData will assign the unformatted data in the EditMask control. The datatype of datavariable must match the datatype of the EditMask control, which you select in the Window painter. Available datatypes are date, DateTime, decimal, double, string, and time. |
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, GetData returns null.
You can find out the datatype of an EditMask control by looking at its MaskDataType property, which holds a value of the MaskDataType enumerated datatype.
This example gets data of datatype date from the EditMask control em_date. Formatting characters for the date are ignored. The String function converts the date to a string so it can be assigned to the SingleLineEdit sle_date:
date d
em_date.GetData(d)
sle_date.Text = String(d, "mm-dd-yy")
This example gets string data from the EditMask control em_string and assigns the result to sle_string. Characters in the edit mask are ignored:
string s
em_string.GetData(s)
sle_string.Text = s
Gets data from the OLE server associated with an OLE control using Uniform Data Transfer.
OLE controls and OLE custom controls
olename.GetData ( clipboardformat, data )
Integer. Returns 0 if it succeeds and -1 if an error occurs.