Retrieves attribute information for field values.
Syntax
intl DlFieldGetValueAttribute ( DlFieldId hField, intl val- num, ValAttribute which, char *buffer, intl bufSize )
Arguments
hField
Handle to field object, as returned by DlFieldGetN. Input
valnum
Zero-based index for values. Use DlFieldGetAttribute with the
DlNumValues enum to return the number of possible values. Input
which
Which attribute to return. Input
ValAttribute Enums | Description |
---|---|
DlKey | Key value |
DlValDescription | Short (32 character) description of the data. |
DlValHelp | Long (256 character) description of the data. |
*buffer
Location to store the returned data. Output
bufSize
Maximum size of data to return in buffer. Input
Return Value
Returns TRUE if attribute is a string and the value was copied to buffer, FALSE if unsuccessful, and -1 for an error condition.
Notes
This function is used to retrieve information about specific data values within a field, such as a description of a piece of data.
See Also
DlFieldGetAttribute
Example
// This example fetches all field value attributes for a given field.
void ShowFieldValueAttributes(DlFileId idField)
{
intl lNumValues, lCount;
char buffer[256];
if (idField)
{
lNumValues = DlFieldGetAttribute(idField, DlNumvalues, buffer, sizeof(buffer));
printf("\n");
if(!lNumValues)
{
printf("No value descriptions for this field.\n");
}
for (lCount = 0; lCount < lNumValues; lCount++)
{
if (DlFieldGetValueAttribute(idField, lCount, DlKey, buffer, sizeof(buffer)))
printf("DlKey: %s\n", buffer);
else
printf("DlKey: <valnum %d unsuccessful>\n", lCount);
if (DlFieldGetValueAttribute(idField, lCount, DlValDescription, buffer, sizeof(buffer)))
printf("DlValDescription: %s\n", buffer);
else
printf("DlValDescription: <unsuccessful>\n");
if (DlFieldGetValueAttribute(idField, lCount, DlValHelp, buffer, sizeof(buffer)))
printf("DlValHelp: %s\n", buffer);
else
printf("DlValHelp: <unsuccessful>\n");
if (!(((lCount + 1) * 4) % PAGE_SIZE))
{
printf("<more>");
gets(buffer);
}
}
}
else
{
printf("\nNo field specified.\n");
}
printf("\n");
}