mult_occ = sm_t_scroll(:cur_field)
mult_occ = @field_num(cur_field)->scrolling
num = sm_n_num_occurs("id_acro")
num = id_acro->num_occurrences
num = sm_max_occur(id_acro_fldnum)
num = @field_num(id_acro_fldnum)->max_occurrences
on_screen_rows = sm_n_size_of_array("currencies")
on_screen_rows = @widget("currencies")->array_size
If the new maximum number of occurrences is less than the current number of occurrences, then the current number of occurrences instead becomes the new maximum number of occurrences. This was true for sm_sc_max and remains true for using the Jam7 max_occurrences property.
If the widget is part of a synchronized scrolling group, then the widget does not have a property max_occurrences and any attempt to access it will be a jpl error. Instead, when it is part of a group, you should instead set the group's max_occurrences property. If the name of the group is unknown, or if you are not sure if the widget is part of a synchronized scrolling group, then query the sync_group property of the widget. If the value is blank, then the widget is not part of a group. If the value contains a name, then that is the name of the group that should have its max_occurrences changed. If the value is a number, then the group is un-named, in which case the number returned represents the @id() of the group; in this case, the group can be accessed by using @id(<id_num>)->max_occurrences syntax.
@widget("typ_a_currences")->max_occurrences = 65
vars group_name = @widget("acct_id")->sync_group if (group_name == "") /* not part of a group */ @widget("acct_id")->max_occurrences = 65 else if (string_is_numeric(group_name) == 1) /* an unnamed group */ @id(group_name)->max_occurrences = 65 else /* a named group */ @widget(group_name)->max_occurrences = 65
The sm_rscroll function shifted the current top occurrence in an array by the number specified. This number could be either positive or negative, depending upon the direction to scroll, where positive numbers represented scroll down and negative numbers represented scroll up. If the occs_to_scroll would take the array past the maximum number of occurrences that could display, or before the first occurrence of the array, then the array would scroll to either its maximum or minimum point.
The sm_ascroll function scrolled the array to the occurrence number specified. If the requested occurrence cannot be placed in the specified field because it is at the beginning or end of the array, then the occurrence is placed onscreen as close as possible to the requested field number. Note that the field number does not have be the first field of the array--instead it could be the field number of any onscreen element--and the function will attempt to place the specified occurrence in that location. The return value from sm_ascroll is the occurrence number that was actually placed in the field specified.
The replacement for both functions is to instead change the first_occurrence run-time property for the widget. However, unlike the two functions above, if the occurrence specified cannot be the top occurrence because the occurrence is near the end of the array a jpl error occurs. Therefore, when using the new syntax, I recommend always checking to see if the new occurrence is a valid occurrence for the array to display. Also, unlike sm_ascroll, it is only possible to set the occurrence for the first element of the array. This is true even if you specify a field number that is not the first element of the array. If you have a function call that sets a later element, then it is necessary to rework this to instead set the top occurrence; this should be a relatively straightforward calculation using the onscreen array_size of the array.
If the scrolling array is part of a synchronized scrolling group, then the shifts in occurrence are automatically applied to the entire group. This is true for both the sm_rscroll and sm_ascroll functions, as well as for the Jam7 property access.
call sm_rscroll(:cur_field, -4)
vars cur_top = @field_num(cur_field)->first_occurrence /* When stepping backwards, if subtracting the backward value */ /* would give a zero or negative occurrence, just back up */ /* to the first occurrence. */ if (cur_top > 4) @field_num(cur_field)->first_occurrence = cur_top - 4 else @field_num(cur_field)->first_occurrence = 1
call sm_n_sscroll("acct_list_1", top_acct_occ)
vars num_element = @widget("acct_list_1")->array_size, max_occ = @widget("acct_list_1")->max_occurrences /* Check to see if when this occ is placed as top, */ /* that the last element displayed would not exceed */ /* the max_occurrences for the array. If it would, scroll */ /* down as far as possible, so occ is displayed on screen. */ if ((max_occ - top_acct_occ) >= num_element) @widget("acct_list_1")->first_occurrence = top_acct_occ else @widget("acct_list_1")->first_occurrence = max_occ - num_element + 1