Programming Guide |
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
orfield_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.
- 0 The number of occurrences actually inserted.
sm_ioccur
insertscount
blank occurrences beforeoccurrence
. If the array is scrollable,sm_ioccur
can allocate up tocount
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:
- If true—
max-occurs
count
+old-occurs
—Panther insertscount
blank occurrences beforeoccurrence
and pushes it and all subsequent occurrences (old-occurs
) down.
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.
#include <smdefs.h>
/* Insert five blank lines at the beginning of
an array named "amounts". */
sm_i_ioccur("amounts", 0, 5);