Perform input field leave processing

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
subroutine ILEAVE_METHOD
 a_inpinfo              ,a
 a_inprec               ,a
 a_methoddata1           ,any
 a_methoddata20          ,any



The structure of input information. (a)


The data_area argument (or data_location argument for I_INPFLD on Windows) passed to the calling input routine. (a)

a_methoddata1 through a_methoddata20

(optional) Up to 20 additional data arguments. (any)


ILEAVE_METHOD is a subroutine you write and name when you want your program to perform extra actions after a specific input field is processed.

This subroutine is called by I_INPUT, I_INPFLD (Windows only), and L_INPUT when a leave method is specified for the current field being processed. You can specify a leave method for the current field by using the LEAVE_METHOD qualifier in a .FIELD script command or the D_FLD_LEAVE option in I_FLDMOD or IB_FIELD.

The ILEAVE_METHOD is called whenever a field is deaccessed by

Note that the leave method is called prior to any break processing or any menu entry dispatching.

When the leave method is called, g_select is true if a menu entry caused the leave. In this case, g_entnam contains the name of that menu entry. Note that the menu entry has not yet been dispatched at this point, and that its action is still pending.

The inpinf.def file defines a_inpinfo. See IARRIVE_METHOD for information.

A_inprec is the record passed to the data_area argument for I_INPUT and L_INPUT and, on Windows, the data_location argument for I_INPFLD. (On UNIX and OpenVMS, this argument is not passed if I_INPFLD is the calling routine.)

A_methoddata1 through a_methoddata20 are up to 20 additional optional arguments that can be passed to I_INPUT, I_INPFLD, or L_INPUT. They are passed, in turn, directly to ILEAVE_METHOD. This enables you to communicate additional information to ILEAVE_METHOD.

See also


.field access_code, a30, pos(3, 2), prompt ("Access code"), fpos(3, 15), -

Given the above field definition, the following leave method, “myleave,” validates the access_code field.

subroutine myleave
;Description: Field leave method for validation access code.
; Arguments
        .include "WND:inpinf.def"               ;Input information
        a_inprec                ,a              ;Input record
; Note:
;       There are up to 20 additional optional arguments that you can pass
;       into i_input, which will be passed into the field leave 
;       method.
;       The field arrive method has the same arguments as the field leave
;       method and can be used to set up anything that needs to be set up
;       when a field is arrived on.
;       This field leave method validates that the access code does
;      not have any spaces and is at least 7 characters long.
.include "WND:tools.def"
.align quad
        length  ,i4     ;Length of input field
        fldnam  ,a30    ;Field name
record data
        acc     ,a30
        data = a_inprec
        length = %trim(acc)
        if ((length .lt. 7) .or. (%instr(l, acc(l:length), "   ")))
            xcall u_message("Invalid access code")
            ; We get the field name from the input string associated to 
            ; the field (its pointer is inp_fldnam). We need to do this
            ; because g_fldnam is NOT set at this point.
            fldnam = %i_getstring(inp_wndid, inp_fldnam)
            ; Initialize the field in the current data set
            xcall i_init(inp_wndid,, data, fldnam)
            a_inprec = data             ;Return the updated data area
            ; Reset the context back to the field
            xcall i_next(inp_wndid, "*CURR*", fldnam)