Form S_152FD: HTML Browser Demonstration D

LANSA

Form S_152FD: HTML Browser Demonstration D
Name: S_152FD

Description: The following RDMLX form is a demonstration of techniques for interfacing LANSA applications with an HTML browser.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(187) LEFT(372) TOP(185) WIDTH(296);
;
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_VERS1) CAPTION('Build and Show Nested Table Example 1') DISPLAYPOSITION(3) LEFT(32) PARENT(#COM_OWNER) TABPOSITION(4) TOP(16) WIDTH(225);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_VERS2) CAPTION('Build and Show Nested Table Example 2') DISPLAYPOSITION(1) LEFT(32) PARENT(#COM_OWNER) TABPOSITION(2) TOP(52) WIDTH(225);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_VERS3) BUTTONDEFAULT(True) CAPTION('Build and Show Nested Table Example 3') DISPLAYPOSITION(2) LEFT(32) PARENT(#COM_OWNER) TABPOSITION(3) TOP(88) WIDTH(225);
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STBR_1) DISPLAYPOSITION(5) HEIGHT(22) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(5) TABSTOP(False) TOP(138) WIDTH(288);
;
DEFINE_COM CLASS(#S_152RHT) NAME(#DOC) DISPLAYPOSITION(4) LEFT(8) PARENT(#COM_OWNER) TABSTOP(False) VISIBLE(False);
;
Define #OutFile RefFld(#SysVar$av);
Define #TableName RefFld(#Std_Texts);
;
Define #Version RefFld(#Std_Num);
Def_Cond *Version2 '#Version <= 2';
Def_Cond *Version1 '#Version <= 1';
;
* =============================================================================== ;
;
EVTROUTINE handling(#com_owner.Initialize);
;
SET #com_owner caption(*component_desc);
;
ENDROUTINE ;
;
* ================================================================================;
;
EVTROUTINE HANDLING(#BTN_VERS1.Click);
Change #Version 1;
Execute BuildShow ;
EndRoutine ;
;
EVTROUTINE HANDLING(#BTN_VERS2.Click);
Change #Version 2;
Execute BuildShow ;
EndRoutine ;
;
EVTROUTINE HANDLING(#BTN_VERS3.Click);
Change #Version 3;
Execute BuildShow ;
EndRoutine ;
;
* ================================================================================;
;
SubRoutine BuildShow;
;
* Build the Document;
;
Execute BldDEP (#TableName);
;
* Save the Document ;
;
Use TConcat (*Temp_Dir *Component '.htm') (#OutFile) ;
Invoke #DOC.Save InFile(#OutFile);
;
* Close the Document ;
;
Invoke #DOC.Close;
;
* Show the Document ;
;
Invoke #DOC.Show InFile(#OutFile);
;
* Finished;
;
ENDROUTINE ;
;
* ================================================================================;
;
* Create and fill a NAMED table of all the employees in a specifed department and section;
;
SubRoutine BldEMP ((#EmpTable *Returned));
Define #EmpTable RefFld(#Std_TextS);
Define #EmpRow RefFld(#Std_Num);
;
Use TConcat ('Emp' #Deptment #Section) (#EmpTable);
;
Use BConcat ('Employees that are assigned to Section' #SecDesc) (#SysVar$Av) ;
Invoke #DOC.DefineTable WithName(#EmpTable) Order(1) WithTitle(#SysVar$Av);
;
Invoke #DOC.DefineTableCell InTable(#EmpTable) WithName(Empno) Order(1) ColHdg1('Number') ;
Invoke #DOC.DefineTableCell InTable(#EmpTable) WithName(GiveName) Order(2) ColHdg1('Given Name') ;
Invoke #DOC.DefineTableCell InTable(#EmpTable) WithName(SurName) Order(3) ColHdg1('Last Name') ;
;
Change #EmpRow 0;
;
Select (#EmpNo #SurName #GiveName) From_File(PslMst1) With_Key(#Deptment #Section) ;
;
Change #EmpRow '#EmpRow + 1';
;
Invoke #DOC.SetTableCell InTable(#EmpTable) WithName(EmpNo) Rownum(#EmpRow) Type(alpha) Alphavalue(#EmpNo) ;
Invoke #DOC.SetTableCell InTable(#EmpTable) WithName(GiveName) Rownum(#EmpRow) Type(alpha) Alphavalue(#GiveName) ;
Invoke #DOC.SetTableCell InTable(#EmpTable) WithName(SurName) Rownum(#EmpRow) Type(alpha) Alphavalue(#SurName) ;
;
EndSelect ;
;
* Finished ;
;
EndRoutine ;
;
* ================================================================================;
;
* Create and fill NAMED table of all the section in a specifed department ;
;
SubRoutine BldSEC ((#SecTable *Returned));
Define #SecTable RefFld(#Std_TextS);
Define #SecRow RefFld(#Std_Num);
;
Use TConcat ('Sec' #Deptment) (#SecTable);
;
Use BConcat ('Sections that belong to Department' #DeptDesc) (#SysVar$Av) ;
;
Invoke #DOC.DefineTable WithName(#SecTable) Order(1) WithTitle(#SysVar$Av);
;
If *Version1;
Invoke #DOC.DefineTableCell InTable(#SecTable) WithName(Section) Order(1) ColHdg1('Section') ColHdg2('Code');
Endif ;
;
If *Version2;
Invoke #DOC.DefineTableCell InTable(#SecTable) WithName(SecDesc) Order(2) ColHdg1('Section') ;
Endif ;
;
Invoke #DOC.DefineTableCell InTable(#SecTable) WithName(Employees) Order(3) ;
;
Change #SecRow 0;
;
Select (#Section #SecDesc) From_File(SecTab) With_Key(#Deptment) ;
;
Change #SecRow '#SecRow + 1';
;
* Optionally insert values into the first 2 cells;
;
If *Version1;
Invoke #DOC.SetTableCell InTable(#SecTable) WithName(Section) Rownum(#SecRow) Type(Alpha) Alphavalue(#Section) ;
Endif ;
;
If *Version2;
Invoke #DOC.SetTableCell InTable(#SecTable) WithName(SecDesc) Rownum(#SecRow) Type(Alpha) Alphavalue(#SecDesc) ;
Endif ;
;
* Create the employee table and insert its name into cell 3 ;
;
Execute BldEMP (#TableName);
Invoke #DOC.SetTableCell InTable(#SecTable) WithName(Employees) Rownum(#SecRow) Type(Table) AlphaValue(#TableName) ;
;
EndSelect ;
;
* Finished ;
;
EndRoutine ;
;
;
* ================================================================================;
;
* Create and fill NAMED table of all the departments that exist ;
;
SubRoutine BldDEP ((#DepTable *Returned));
Define #DepTable RefFld(#Std_TextS);
Define #DepRow RefFld(#Std_Num);
;
Change #DepTable Departments;
;
Invoke #DOC.DefineTable WithName(#DepTable) Order(1) WithTitle('Departments');
;
If *Version1;
Invoke #DOC.DefineTableCell InTable(#DepTable) WithName(Deptment) Order(1) ColHdg1('Department') ColHdg2('Code');
Endif ;
;
If *Version2;
Invoke #DOC.DefineTableCell InTable(#DepTable) WithName(DeptDesc) Order(2) ColHdg1('Department') ;
Endif ;
;
Invoke #DOC.DefineTableCell InTable(#DepTable) WithName(Sections) Order(3) ;
;
Change #DepRow 0;
;
Select (#Deptment #DeptDesc) From_File(DepTab) ;
;
Change #DepRow '#DepRow + 1';
;
* Insert values into the first 2 cells;
;
If *Version1;
Invoke #DOC.SetTableCell InTable(#DepTable) WithName(Deptment) Rownum(#DepRow) Type(Alpha) Alphavalue(#Deptment) ;
Endif ;
;
If *Version2;
Invoke #DOC.SetTableCell InTable(#DepTable) WithName(DeptDesc) Rownum(#DepRow) Type(Alpha) Alphavalue(#DeptDesc) ;
Endif ;
;
* Create the sections table, then put its name into cell 3 ;
;
Execute BldSEC (#TableName);
Invoke #DOC.SetTableCell InTable(#DepTable) WithName(Sections) Rownum(#DepRow) Type(Table) AlphaValue(#TableName) ;
;
EndSelect ;
;
* Finished ;
;
EndRoutine ;
;
;
;
END_COM ;