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);
FLDget_node_data_label gets the labels string within the Data_Array of one component of a Node_Data.
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);
}