Form VL_SAM031: Multi-Form Essentials 1

LANSA

Form VL_SAM031: Multi-Form Essentials 1
Name: VL_SAM031

Description: The following RDMLX form demonstrates the essential details of multi-form communications. It should be used in conjunction with forms VL_SAM032 and VL_SAM033.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM BORDERICONS(Maximize+Minimize+SystemMenu) HEIGHT(205) LEFT(44) TOP(13) WIDTH(416);
* ;
* Form Layout ;
* ;
DEFINE_COM CLASS(#EMPNO.Visual) NAME(#EMPNO) DISPLAYPOSITION(1) HEIGHT(19) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(1) TOP(40) WIDTH(209);
DEFINE_COM CLASS(#SURNAME.Visual) NAME(#SURNAME) DISPLAYPOSITION(2) HEIGHT(19) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(2) TOP(72) WIDTH(324);
DEFINE_COM CLASS(#SALARY.Visual) NAME(#SALARY) DISPLAYPOSITION(3) HEIGHT(19) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(3) TOP(104) WIDTH(278);
DEFINE_COM CLASS(#DATE.Visual) NAME(#DATE) DISPLAYPOSITION(4) HEIGHT(19) LEFT(16) MARGINLEFT(169) PARENT(#COM_OWNER) TABPOSITION(4) TOP(140) WIDTH(236);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('Details entered on this form should be immediately reflected onto the other 2 forms ') DISPLAYPOSITION(5) HEIGHT(25) LEFT(17) PARENT(#COM_OWNER) TABPOSITION(5) TABSTOP(False) TOP(8) WIDTH(401);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_CLEAR) CAPTION('Clear Fields') DISPLAYPOSITION(6) LEFT(320) PARENT(#COM_OWNER) TABPOSITION(6) TOP(144);
* ;
* Child forms of class named #form2 and #form3 respectively ;
* ;
DEFINE_COM CLASS(#VL_SAM032) NAME(#FORM2) BORDERICONS(Maximize+Minimize+SystemMenu) HEIGHT(205) LEFT(354) TOP(145) WIDTH(416);
DEFINE_COM CLASS(#VL_SAM033) NAME(#FORM3) BORDERICONS(Maximize+Minimize+SystemMenu) HEIGHT(205) LEFT(354) TOP(145) WIDTH(416);
* ;
* Start Forms 2 and 3 showing and locate them all in a line;
* ;
EVTROUTINE handling(#com_owner.Initialize);
set #com_owner caption('Form 1');
invoke #form2.ShowForm;
invoke #form3.ShowForm;
set #com_owner top(10) left(10);
change #std_num '#com_owner.top + #com_owner.height';
set #form2 top(#std_num) left(10);
change #std_num '#com_owner.top + (2 * #com_owner.height)';
set #form3 top(#std_num) left(10);
ENDROUTINE ;
* ;
* If empno changes, change form 2 and 3's empno as well ;
* ;
evtroutine (#empno.changed);
set (#form2 #form3) currempno(#empno) ;
endroutine ;
* ;
* If surname changes, change form 2 and 3's surname as well ;
* ;
evtroutine (#surname.changed);
set (#form2 #form3) currsurname(#surname) ;
endroutine ;
* ;
* If salary changes, change form 2 and 3's salary as well ;
* ;
evtroutine (#salary.changed);
set (#form2 #form3) currsalary(#salary) ;
endroutine ;
* ;
* If date changes, change form 2 and 3's date as well ;
* ;
evtroutine (#date.changed);
set (#form2 #form3) currdate(#date) ;
endroutine ;
* ;
* If empno changes on form 2, change on this form and on form 3 ;
* ;
evtroutine #form2.empnochanged;
change #empno #form2.currempno;
set #form3 currempno(#empno);
endroutine ;
* ;
* If empno changes on form 3, change on this form and on form 2 ;
* ;
evtroutine #form3.empnochanged;
change #empno #form3.currempno;
set #form2 currempno(#empno);
endroutine ;
* ;
* Same for surname ....;
* ;
evtroutine #form2.surnamechanged;
change #surname #form2.currsurname;
set #form3 currsurname(#surname);
endroutine ;
evtroutine #form3.surnamechanged;
change #surname #form3.currsurname;
set #form2 currsurname(#surname);
endroutine ;
* ;
* and for salary ....;
* ;
evtroutine #form2.salarychanged;
change #salary #form2.currsalary;
set #form3 currsalary(#salary);
endroutine ;
evtroutine #form3.salarychanged;
change #salary #form3.currsalary;
set #form2 currsalary(#salary);
endroutine ;
* ;
* and for date ....;
* ;
evtroutine #form2.datechanged;
change #date #form2.currdate;
set #form3 currdate(#date);
endroutine ;
evtroutine #form3.datechanged;
change #date #form3.currdate;
set #form2 currdate(#date);
endroutine ;
* ;
* handle clear all fields button;
* ;
EVTROUTINE HANDLING(#BTN_CLEAR.Click);
change (#empno #surname #salary #date) *null;
set (#form2 #form3) currempno(#empno) ;
set (#form2 #form3) currsurname(#surname) ;
set (#form2 #form3) currsalary(#salary) ;
set (#form2 #form3) currdate(#date) ;
ENDROUTINE ;
* ;
* Normal closing routine ;
* ;
evtroutine #com_owner.closing;
invoke #form2.CloseForm;
invoke #form3.CloseForm;
endroutine ;
;
END_COM ;