Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
subroutine EDSPFLD_METHOD a_input ,a a_type ,a a_text ,a a_window ,n a_fldnum ,n a_dest ,a a_attr ,n a_color ,n a_inpinfo ,a
The contents of the input field. (a)
The user_type string specified in the .FIELD USER qualifier. (a)
(optional) The user_text string specified in the .FIELD USER qualifier. (a)
The ID of the input window being processed. (n)
Contains the internal field number of the current display field. (n)
(optional) The data area in which to store the displayed data. If it is present, EDSPFLD_METHOD must load a_dest in storage format. (a)
The attribute to apply to the display. (n)
The color to apply to the display. (n)
The structure of input information. (a)
EDSPFLD_METHOD is a subroutine that you write and name. The name of your subroutine is registered with UI Toolkit using the E_METHOD subroutine.
We recommend using an input field display method (%IDISPLAY_METHOD) instead of EDSPFLD_METHOD. Unlike EDSPFLD_METHOD, your %IDISPLAY_METHOD adds to Toolkit functionality rather than replaces it. %IDISPLAY_METHOD also provides access to the structure defined in inpinf.def and to the 20 optional arguments passed to I_INPUT and L_INPUT. See %IDISPLAY_METHOD for more information.
EDSPFLD_METHOD cannot populate a field that has a view length that’s shorter than the display length.
The UI Toolkit input subroutine calls your EDSPFLD_METHOD subroutine to display the contents of the current input field. It is also called after the ECHKFLD_METHOD subroutine validates the user‑defined input to display the validated data in the specified format. It is only called if the field definition uses the user_type argument in the .FIELD USER qualifier.
You will never call EDSPFLD_METHOD directly; it is called only by UI Toolkit.
The inpinf.def file defines a_inpinfo. See IARRIVE_METHOD for information.
S/DE Repository enables you to specify a subtype (or class) for user‑defined fields. The default subtype is alpha, but you can also specify numeric or date. To access this subtype within the Toolkit user‑defined processing routines, use the window ID and field number contained within the inputinfo structure (the a_inpinfo argument). Pass these two values to the I_FLDINF subroutine to retrieve the gs_inpfld structure (the controls argument) which contains the gs_class (user subtype) value. For user‑defined alpha fields; gs_class = 0; for user‑defined numeric fields, gs_class = 1; for user‑defined date fields, gs_class = 2.
To display the user‑defined input in a special format, you must call the Synergy DBL subroutine W_FLDS. The subroutine call can look like this:
xcall w_flds(a_window, WF_PUT, a_fldnum, display_text, WF_ATTR, a_fldnum, a_attr, & WF_COLOR, a_fldnum, a_color)
where display_text is the specially formatted input to display in the input field.
EDSPFLD_METHOD works in conjunction with the ECHKFLD_METHOD and EEDTDSP_METHOD subroutines. The following steps occur for a user‑defined field:
|1.||When your program calls I_DISPLAY or I_DSPFLD, UI Toolkit also calls EDSPFLD_METHOD and passes it the field’s data in the format it was stored. EDSPFLD_METHOD displays the data in the field with the formatting you have specified in the EDSPFLD_METHOD subroutine.|
For example, if you have written EDSPFLD_METHOD so that it formats all case “A” numbers with a dollar sign and a decimal point, it will display $350.00 when passed the stored data “350A.”
|2.||When the user selects the field for editing, UI Toolkit calls EEDTDSP_METHOD and passes it the data in storage format. The supplied EEDTDSP_METHOD displays the editable data in the stored format. If you want the editable data to display differently, you must write your own version of EEDTDSP_METHOD.|
For example, once the user has selected the “350A” data for editing, your EEDTDSP_METHOD might re‑display the data as “350.” If you used the supplied version of EEDTDSP_METHOD, the editable data would display as “350A.”
|3.||After the user edits the data, UI Toolkit calls ECHKFLD_METHOD to validate the new data, determining if it meets all of your specified criteria. If ECHKFLD_METHOD validates the data, EDSPFLD_METHOD is called again to display the new data including the proper formatting.|
If the user has changed “350” to “150,” ECHKFLD_METHOD is called and checks to make sure “150” is an acceptable entry for that field. If it is, EDSPFLD_METHOD displays “$150.00” in the field.
The following example shows how you can use ECHKFLD_METHOD and EDSPFLD_METHOD to handle user‑defined field types. See the ECHKFLD_METHOD Discussion for a sample window script that corresponds with this example.
See the ECHKFLD_METHOD Examples for an example that uses ECHKFLD_METHOD, EDSPFLD_METHOD, and EEDTSP_METHOD to validate and display a ZIP Code.
; Description: Routines for handling user-defined field types ; ; Reprinted by permission of BancTec, Inc. ; ; Routines: ; ECHKFLD_METHOD - Validation of user-defined types ; EDSPFLD_METHOD - Display and storage of user-defined types ; subroutine ECHKFLD_METHOD ; Description: Validate user-defined data types ; Arguments: ; a_input ,a ;Text as input a_type ,a ;User-defined data type a_text ,a ;User text for field a_status ,n ;Returned status a_inpinfo ,a ;Input information .include "WND:tools.def" .align record sts ,i4 ;Decoding status yr ,i4 mo ,i4 da ,i4 proc case a_type of begincase "MDYDATE ":call mdydate endcase else begin xcall u_message("Unrecognized user type "+a_type) end xreturn ; ; Description: Handle MM/DD/YY date format ; mdydate, xcall u_dcddat(sts, a_input, 3,, yr, mo, da) if (sts) then a_status = D_DATERR else begin clear a_status a_input = %string(mo, "XX")+%string(da, "XX")+%string(yr,"XX") end return endsubroutine subroutine EDSPFLD_METHOD ; ; Description: Handle display and storage of user-defined data types ; ; Arguments: a_input ,a ;Contents of field a_type ,a ;User-defined type a_text ,a ;User text a_window ,n ;Input window ID a_fldnm ,n ;Display field number a_dest ,a ;Destination (optional) a_attr ,n ;Display attribute a_color ,n ;Display color a_inpinfo ,a ;Input information ; .include "WND:tools.def" .include "WND:windows.def" ; record group yymmdd ,d yy ,d2 mm ,d2 dd ,d2 endgroup buf ,a8 ; proc case a_type of begincase "MDYDATE ":call mdydate endcase else begin xcall u_message("Unrecognized user type "+a_type) end xreturn ; ; Description: Display and store MM/DD/YY dates ; mdydate, yy = a_input(5:2) mm = a_input(1:2) dd = a_input(3:2) xcall u_fmtdat(3, buf, yy, mm, dd) xcall w_flds(a_window, WF_PUT, a_fldnm, buf, WF_ATTR, & a_fldnm, a_attr, WF_COLOR, a_fldnm, a_color) if (^passed(a_dest)) a_dest(1:6) = a_input ; To avoid clobbering following fields. Defined as d8, but stored as d6. return endsubroutine