The Visual LANSA form has exactly the same functionality as the previous application. In addition it indicates which fields are mandatory by enabling and disabling them based on marital status. This instant feedback guides the user to enter the required information:
Source for the Form
Here is the source for the form:
***************************************************
*
* COMPONENT: STD_FORM
*
***************************************************
FUNCTION OPTIONS(*DIRECT)
BEGIN_COM HEIGHT(240) LEFT(313) TOP(155) WIDTH(600)
* Component Definitions
DEFINE_COM CLASS(#IDNO.Visual) NAME(#IDNO) DISPLAYPOSITION(1) HEIGHT(19) LEFT(16) MARGINLEFT(120) PARENT(#COM_OWNER) TABPOSITION(1) TOP(16) WIDTH(209)
DEFINE_COM CLASS(#SPOUSE.Visual) NAME(#SPOUSE) DISPLAYPOSITION(2) HEIGHT(19) LEFT(200) PARENT(#COM_OWNER) TABPOSITION(2) TOP(56) WIDTH(369)
DEFINE_COM CLASS(#MARRIED.Visual) NAME(#MARRIED) DISPLAYPOSITION(3) HEIGHT(19) LEFT(200) PARENT(#COM_OWNER) TABPOSITION(3) TOP(80) WIDTH(232)
DEFINE_COM CLASS(#DIVORCED.Visual) NAME(#DIVORCED) DISPLAYPOSITION(5) HEIGHT(19) LEFT(200) PARENT(#COM_OWNER) TABPOSITION(5) TOP(104) WIDTH(232)
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#SAVE) CAPTION('Save') DISPLAYPOSITION(4) LEFT(488) PARENT(#COM_OWNER) TABPOSITION(4) TOP(120)
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#DELETE) CAPTION('Delete') DISPLAYPOSITION(6) LEFT(488) PARENT(#COM_OWNER) TABPOSITION(6) TOP(152)
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#FETCH) CAPTION('Fetch') DISPLAYPOSITION(7) HEIGHT(17) LEFT(288) PARENT(#COM_OWNER) TABPOSITION(7) TOP(16) WIDTH(57)
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) CAPTION('Marital Status') DISPLAYPOSITION(8) HEIGHT(97) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(8) TABSTOP(False) TOP(40) WIDTH(153)
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_1) CAPTION('Never Married') DISPLAYPOSITION(1) LEFT(16) PARENT(#GPBX_1) TABPOSITION(1) TOP(16) WIDTH(105)
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_2) CAPTION('Married') DISPLAYPOSITION(2) LEFT(16) PARENT(#GPBX_1) TABPOSITION(2) TOP(38) WIDTH(65)
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_3) CAPTION('Divorced') DISPLAYPOSITION(3) LEFT(16) PARENT(#GPBX_1) TABPOSITION(3) TOP(60) WIDTH(73)
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STBR_1) DISPLAYPOSITION(9) HEIGHT(23) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(9) TOP(190) WIDTH(592)
* Other definitions
GROUP_BY NAME(#PANELDATA) FIELDS(#STATUS #SPOUSE #MARRIED #DIVORCED)
EVTROUTINE handling(#com_owner.Initialize)
SET #com_owner caption(*component_desc)
ENDROUTINE
* Event routines
* Fetch file mstatus details
EVTROUTINE HANDLING(#FETCH.Click)
FETCH FIELDS(#PANELDATA) FROM_FILE(mstatus) WITH_KEY(#IDNO) ISSUE_MSG(*YES)
if cond('#status *eq N')
set com(#RDBN_1) ButtonChecked(True)
set com(#spouse #married #divorced) enabled(false)
endif
if cond('#status *eq M')
set com(#RDBN_2) ButtonChecked(True)
set com(#spouse #married) enabled(true)
set com(#divorced) enabled(false)
endif
if cond('#status *eq D')
set com(#RDBN_3) ButtonChecked(True)
set com(#spouse #married #divorced) enabled(true)
endif
ENDROUTINE
* Enable and disable fields according to marital status
EVTROUTINE HANDLING(#RDBN_1.Click )
set com(#spouse #married #divorced) enabled(false)
set com(#spouse) value(*blank)
set com(#married #divorced) value(*zero)
change #status 'N'
ENDROUTINE
EVTROUTINE HANDLING( #RDBN_2.Click )
set com(#spouse #married) enabled(true)
set com(#divorced) value(*zero)
set com(#divorced) enabled(false)
change #status 'M'
ENDROUTINE
EVTROUTINE HANDLING(#RDBN_3.Click)
set com(#spouse #married #divorced) enabled(true)
change #status 'D'
ENDROUTINE
*Save details
EVTROUTINE HANDLING(#Save.Click)
UPDATE FIELDS(#PANELDATA) IN_FILE(mstatus)
ENDROUTINE
EVTROUTINE HANDLING(#DELETE.Click)
DELETE FROM_FILE(mstatus) ISSUE_MSG(*YES)
ENDROUTINE
END_COM
Also see Code Comparison