![]() | 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_namecan also be a grid frame or a syncronized scrolling group.occurrence- Specifies where to insert the first occurrence in the array specified by
field_numberorfield_name, where 0 inserts the new occurrences at the beginning of the array.count- The number of new occurrences to insert. If
countis negative, occurrences are deleted instead, subject to the same limitations described for sm_doccur.
0 The number of occurrences actually inserted.
sm_ioccurinsertscountblank occurrences beforeoccurrence. If the array is scrollable,sm_ioccurcan allocate up tocountnew 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 insertscountblank occurrences beforeoccurrenceand pushes it and all subsequent occurrences (old-occurs) down.
Note that
sm_ioccurnever increases the maximum number of occurrences an array can contain; you can do this by resetting the arrays'max_occurrencesproperty.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_ioccuris 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);