3.67 DM_SetVectorValue
Using this function you can set attributes which occur several times in an object (so-called "vector attributes").
DM_Boolean DML_default DM_EXPORT DM_SetVectorValue
(
DM_ID objectID
DM_Attribute attr,
DM_Value *firstindex,
DM_Value *lastindex,
DM_VectorValue *values,
DM_Options options
)
Parameters
-> DM_ID objectID
Describes the object the attribute of which you want to change.
-> DM_Attribute attr
Describes the attribute to be changed.
-> DM_Value *firstindex
Controls which range of the contents is modified by this function. This parameter then defines the starting point of the range.
For a listbox or a poptext the type in the DM_Value structure has to be set to DT_index and the index value in the union has to be assigned the starting value. For tablefield you have to set the type in the DM_Value structure to DT_index and the index value in the union has to be assigned the starting value. For index.first you have to specify the row, for index.second you have to specify the column.
Note
If this parameter is a NULL pointer, the starting point has the following defaults, e.g.
listbox |
integer = 1 |
tablefield |
index.first = 1, index.second = 1 |
-> DM_Value *lastindex
Controls which range of the contents is to be modified by this function. This parameter defines the last point of the range. For a listbox or a poptext the type in the DM_Value structure has to be set to DT_index and the index value in the union has to be assigned the ending value. For tablefield you have to set the type in the DM_Value structure to DT_index and the index value in the union has to be assigned the ending value. For index.first you have to specify the line, for index.second you have to specify the column.
Note
If the parameter is a NULL pointer, the ending point is defined by the size of the new contents. The object contents is cut after the last modified entry.
listbox |
.itemcount is modified |
tablefield |
if direction = 1, then .rowcount will be modified if direction = 2, then .colcount will be modified |
-> DM_VectorValue *values
Pointer to the values to be set. By the field type in the DM_VectorValue structure you can control which data type the individual values have.
By the field count in the DM_VectorValue structure you can control how many values a vector is to have.
-> DM_Options options
Controls whether the DM is to trigger rule processing after an attribute has been set successfully.
Option |
Meaning |
---|---|
This option means that the function call is not to trigger any internal events. If this flag is set, you can achieve a better performance in case a lot of attribute changes have been made by the application. |
|
This option means that the function call is to trigger internal events. Then rules are triggered which have been defined for this object and which react to the changing of the specified attribute. |
|
The specified string is to be translated into the currently used language. This is of course only possible if the text already exists internally and if also a translation exists for it. |
Return Value
TRUE |
The attribute was set successfully. |
FALSE |
The attribute could not be set. |
Example
A new content is to be set for a listbox.
void DML_default DM_ENTRY SetVector __1((DM_ID, lb)){ DM_Value first, last;
DM_VectorValue vec;
char *list[9]
list[0] = "V_1";
list[1] = "V_2";
list[2] = "V_3";
list[3] = "V_4";
list[4] = "V_5";
list[5] = "V_6";
list[6] = "V_7";
list[7] = "V_8";
list[8] = "V_9";
/*
** Setting the starting and ending line
** Content of line 1 to 9 is replaced by
** the new content. The rest remains unchanged.
*/
first.type = DT_integer;
first.value.integer = 1;
last.type = DT_integer;
last.value.integer = 9;
/* Specifying the number of lines to be set */
vec.type = DT_string;
vec.count = 9;
vec.vector.stringPtr = list;
DM_SetVectorValue(lb, AT_content, &first, &last, &vec,
DMF_ShipEvent);
}