6.8.22 DMcob_GetValue

With this function you can inquire attributes of DM objects. For the permitted attributes of the respective object type, please refer to the charts in chapter “Attributes and Definitions”.

call "DMcob_GetValue" using
            DM-StdArgs
            DM-Value.

Parameters

-> DM-Object of DM-Value

This parameter describes the object whose attribute you want to request. You have received this identifier as return value from the DMcob_PathToID function.

-> DM-Attribute of DM-Value

This parameter describes the object attribute you want to inquire. All permitted attributes are defined in the IDMcobws.cob file.

-> DM-Index of DM-Value

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

<- DM-Datatype of DM-Value

In this parameter, you get the data type of the inquired attribute. You should take care to read this before you access the data. For the data type of each attribute please refer to chapter “Attributes and Definitions”.

-> DM-Indexcount of DM-Value

This parameter indicates how many index values are to be noticed when calling the function:

  • 2-dimensional attributes -> value = 2 has to be set
  • 1-dimensional attributes -> value = 1 has to be set
  • non-indexed attributes -> value = 0 has to be set

-> DM-value-string-getlen of DM-Value

This parameter indicates how long the string to be inquired can be.

<- DM-value-object of DM-Value
<- DM-value-boolean of DM-Value
<- DM-value-classid of DM-Value
<- DM-value-integer of DM-Value
<- DM-value-string of DM-Value

In one of these parameters you get the value of the inquired attribute. The value which is set depends on the data type of the attribute. For the data type of each attribute, please refer to chapter “Attributes and Definitions”.

-> DM-Options

With this parameter the form of the texts returned by the DM is controlled if the corresponding attribute has the type Text.

  • DMF-GetMasterString

    The original string is returned if DMF-GetMasterString is specified here.

  • DMF-GetLocalString

    The string is returned in the currently set language if DMF-GetLocalString is specified.

  • DMF-GetTextID

    Only the text ID is returned if DMF-GetTextID is specified. This text ID can be used for settings with DMcob_SetValue.

COBOL Interface for Micro Focus Visual COBOL

Instead of DM-value-string, it is also possible to use DM-value-string-u when working with Unicode texts (UTF-16).

DM-value-string-getlen and DM-value-string-putlen continue to indicate the number of characters and not the number of bytes.

Return Value

DM-Status of DM-StdArgs

DM-error

The attribute is not permitted for this object.

DM-success

The object could be inquired successfully.

Example

To access the title of a window named "TestWindow" the COBOL program should look as follows:

    move 0 to DM-indexcount.

    move AT-title to DM-Attribute.

    move DMF-GetMasterString to DM-Options.

    Call "DMcob_GetValue" using DM-StdArgs DM-Value.

    if DM-Datatype is equal to DT-string

        display DM-value-string.