3.34 DM_GetValueIndex
This function can be used to query attributes with two indexes.
The attributes which are allowed for the relevant object type are listed in the “Object Reference”.
DM_Boolean DML_default DM_EXPORT DM_GetValueIndex
(
DM_ID objectID,
DM_Attribute attr,
DM_Value *index,
DM_Value *data,
DM_Options options
)
Parameters
-> DM_ID objectID
Describes the object whose attribute you query.
-> DM_Attribute attr
Describes the attribute you query. Valid attributes are defined in IDMuser.h.
-> DM_Value *index
Specifies the data type of the index (enum, index) and its value.
In this parameter you receive the value of the desired attribute. You have to make sure that the right element has to be read out of this union. The attributes which are allowed for the relevant object type are listed in the “Object Reference”.
-> DM_Options options
Using this parameter you can control in which form the texts are returned from the Dialog Manager, if the corresponding attribute is of the text-type. The following assignments are possible with this parameter:
Option |
Meaning |
---|---|
This object means that the string of textual attributes is to be returned in the development language, independently of the language the user is working with. |
|
This option means that the string of textual attributes is returned in the selected language. |
|
This option means that the string of textual attributes is returned as textID. This is especially useful if the text is to be assigned to another object. |
|
Usually, strings are transferred in a temporary buffer (which remains until the next call to DM) to the application. If strings are to remain valid for a longer time in the application, the option DMF_DontFreeLastStrings has to be set. The memory will only be released, if a DM function is called without this option and if then a string is returned by the DM to the application. |
Return Value
TRUE |
The object could be queried successfully. |
FALSE |
The attribute is not permitted for this object. |
Example
Querying a vectorial user-defined attribute of a groupbox or a window.
void DML_default DM_ENTRY GetInfo __1((DM_ID, obj))
{
DM_Value attr;
DM_Value data, index;
DM_ID groupbox;
DM_GetValue(obj, AT_parent, 0, &data, 0);
groupbox = data.value.id;
DM_TraceMessage("\nin GetInfo\n",DMF_Printf);
/*
** Getting the number of user-defined attributes
*/
if (DM_GetValue(obj, AT_membercount, 0, &data, 0))
DM_TraceMessage("groupbox.membercount = %ld\n",
DMF_Printf, data.value.integer);
/*
** Choosing the name of the user-defined attribute
*/
index.type = DT_string;
index.value.string = ".StringVec";
if (DM_GetValueIndex(groupbox, AT_label, &index, &attr, 0))
{
DM_Integer n, i;
DM_GetValueIndex(groupbox, AT_count, &attr, &data, 0);
n = data.value.integer;
for (i=1 ; i<=n; i++)
{
DM_GetValue(groupbox, attr.value.attribute, i, &data,
0);
DM_TraceMessage ("first attribute%ld.string %s\n",
DMF_Printf, i, data.value.string);
}
}
}