3.33 DM_GetValue

Using this function you can query attributes of DM objects. For the attributes which are allowed for the relevant object type please refer to the “Object Reference”.

DM_Boolean DML_default DM_EXPORT DM_GetValue
(
  DM_ID objectID,
  DM_Attribute attr,
  DM_UInt index,
  DM_Value *data,
  DM_Options options
)

Parameters

-> DM_ID objectID

This parameter describes the object whose attribute you want to query.

-> DM_Attribute attr

This parameter describes the object attribute you want to query. All attributes permitted are defined in the file IDMuser.h.

-> DM_UInt index

This parameter is analyzed only in vector attributes of objects and describes the index of the desired object (e.g. text in listbox).

-> DM_Value *data

In this parameter you can query the attribute value. You should make sure that you read out the correct element out of this union. For the data type of each attribute please refer to the “Object Reference”.

-> DM_Options options

With this parameter you can control which form of texts are returned by DM, if the corresponding attribute is of the text-type. The following assignment is possible for this parameter:

Option

Meaning

DMF_GetMasterString

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.

DMF_GetLocalString

This option means that the string of textual attributes is returned in the selected language.

DMF_GetTextID

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.

DMF_DontFreeLastStrings

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 the contents of an editable text in an object-callback function.

DM_Boolean DML_default DM_CALLBACK CheckFilename __1(

(DM_CallBackArgs *, data))

{

    DM_Value value;    /*structure for DM_GetValue*/

 

    /* get current contents */

    if (DM_GetValue(data->object, AT_content, 0, &value,

                    DMF_GetLocalString))

        /* check the datatype */

        if(value.type == DT_string)

See Also

Built-in function getvalue() in manual “Rule Language”