FLDget_node_data_label, FLDset_node_data_label

Synopsis

get the label within one Node_Data component

int FLDget_node_data_label (
OMobj_id field,
int comp,
char *label,
int size);

int FLDset_node_data_label (OMobj_id field,
int comp,
const char *label);

Description

FLDget_node_data_label gets the labels string within the Data_Array of one component of a Node_Data.

Parameters

OMobj_id field

The OMobj_id of a field that contains a Node_Data subobject.

int comp

An integer that specifies which component's [0-n] label to get.

char *label

A character string in which the string will be returned. The user is responsible for providing size bytes of storage.

size

An integer that sets the maximum length that the label may have. In practice, this is always the same as the length declared for the label array. If the label returned happens to be longer than size, it is truncated to size.

Examples

This example, a fragment of modules/labels.c, shows the DVnode_data_labels base module retrieving the label for each component in a Node_Data, and placing it in the output object (for example, a UIradioBoxLabel widget). If there is no label set for a component, it sets the label to "NO NAME".

define MAX_LABEL_SIZE 1024

node_data_labels(obj_id)
OMobj_id obj_id;
{
OMobj_id in, out;
int stat, comp, ncomp;
char label[MAX_LABEL_SIZE];

in = OMfind_subobj(obj_id, OMstr_to_name("in"),OM_OBJ_RD);
out = OMfind_subobj(obj_id, OMstr_to_name("labels"),OM_OBJ_RW);

if ((stat = FLDget_node_data_ncomp(in, &ncomp))!= 1)
return(stat);
for (comp=0; comp<ncomp; comp++) {
stat = FLDget_node_data_label(in, comp, label, MAX_LABEL_SIZE);
if (stat < 0)
return(stat);
else if (stat == 0)
strcpy(label, "NO NAME");
if ((stat = OMset_str_array_val(out, comp, label))!= 1)
return(stat);
}
return(1);
}

Files

v/fld.v.

See Also

FLDget_cell_data_label
FLDget_node_data_units