Programming Guide



sm_*ioccur

Inserts blank occurrences into an array

int sm_i_ioccur(char *field_name, int occurrence, int count);
int sm_o_ioccur(int field_number, int occurrence, int count);

field_name, field_number
The array to receive new occurrences. In Panther 5.50 and later, field_name can also be a grid frame or a syncronized scrolling group.

occurrence
Specifies where to insert the first occurrence in the array specified by field_number or field_name, where 0 inserts the new occurrences at the beginning of the array.

count
The number of new occurrences to insert. If count is negative, occurrences are deleted instead, subject to the same limitations described for sm_doccur.

Returns

Description

sm_ioccur inserts count blank occurrences before occurrence. If the array is scrollable, sm_ioccur can allocate up to count new occurrences. Before it inserts these, Panther checks whether the array's maximum number of occurrence is equal or greater than count plus existing data-filled occurrences:

Note that sm_ioccur never increases the maximum number of occurrences an array can contain; you can do this by resetting the arrays' max_occurrences property.

Panther inserts the same number of occurrences for synchronized arrays that are unprotected from clearing. If a synchronized array is protected from clearing, Panther leaves it unchanged. Thus, you can synchronize a protected array that contains an unchanging sequence of numbers with an adjoining unprotected array whose data grows and shrinks.

sm_o_ioccur is normally invoked by the logical key INSL.

Example

#include <smdefs.h>
/* Insert five blank lines at the beginning of
an array named "amounts". */

sm_i_ioccur("amounts", 0, 5);

See Also

sm_doccur