sm_name(field_number)
wid_name = sm_name(cur_fld_num)
wid_name = @field_num(cur_fld_num)->name
sm_getcurno()
In practice the need to get the current field number can usually be eliminated. Instead, just using the @widget("@current") shortcut to directly query and change the properties of a widget is easier and quicker.
fieldnum = sm_getcurno()
fieldnum = @widget("@current")->fld_num
- sm_e_fldno(field_name, element)
- sm_i_fldno(field_name, occurrence)
- sm_n_fldno(field_name)
- sm_o_fldno(field_number, occurrence)
Note: the sm_fldno variant does not exist.
The Jam7 replacement is to query the field number property on the widget. If querying for a name or an element, then the result is should always be valid. If the name and/or element number specified does not exist on the screen, then a jpl error will occur.
If querying for an occurrence, unforunately, it is always necessary to check to see if that occurence is currently displayed first. Unlike the sm_*_fldno function, if the occurrence is not currently onscreen a jpl error will occur even if the occurrence is valid for the specified widget. Of course a jpl error will also occur if the widget name, field_number, or occurrence does not exist on the current screen.
field1 = sm_e_fldno("acct_names",2)
field1 = @widget("acct_names")[[2]]->fldnum
field3 = sm_n_fldno("acct_types")
field3 = @widget("acct_types")->fldnum
field2 = sm_i_fldno("acct_nums",4)
vars first_occ = @widget("acct_nums")->first_occurrence if (first_occ <= 4 && (first_occ + @widget("test")->array_size) >= 4) field2 = @widget("acct_nums")[4]->fldnum else field2 = 0
field1 = sm_o_fldno(7,3)
vars first_occ = @field_num(7)->first_occurrence if (first_occ <= 3 && (first_occ + @widget("test")->array_size) >= 3) field1 = @field_num(7)[3]->fldnum else field2 = 0
Note: In practice the request for the field number can often be eliminated in both C and jpl, since all functions and all property access can be done simply with the name of the widget, rather than the field number. In addition, I recommend the use of the field name, since this makes inherently cleaner code.
sm_base_fldno(field_number)
array_top = sm_base_fldno(:cur_fld)
array_top = @field_num(cur_fld)[[1]]->fldnum
Any code sections that use sm_create_id should be eliminated. Usually this is a backhanded way to get a handle to an object so that a property for that object can be changed. Replace the code segment with a direct assignment to the property. For example, see the next example that uses the