Form VL_SAM103: Advanced High Speed Data Entry Techniques
Name: VL_SAM103
Description: The following RDMLX form is used to demonstrate some advanced high speed data entry techniques.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(200) LEFT(318) TOP(164) VISUALSTYLE(#VS_NORM) WIDTH(438);
;
* The form fields ;
;
DEFINE_COM CLASS(#SALARY.Visual) NAME(#SALARY) DISPLAYPOSITION(1) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(1) TOP(8) WIDTH(265);
DEFINE_COM CLASS(#SALARYAVG.Visual) NAME(#SALARYAVG) DISPLAYPOSITION(2) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(2) TOP(34) WIDTH(265);
DEFINE_COM CLASS(#DEPTMENT.Visual) NAME(#DEPTMENT) DISPLAYPOSITION(3) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(3) TOP(60);
DEFINE_COM CLASS(#SALARYMAX.Visual) NAME(#SALARYMAX) DISPLAYPOSITION(4) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(4) TOP(86) WIDTH(265);
DEFINE_COM CLASS(#SALARYMIN.Visual) NAME(#SALARYMIN) DISPLAYPOSITION(5) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(5) TOP(112) WIDTH(265);
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STBR_1) DISPLAYPOSITION(7) HEIGHT(22) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(8) TOP(151) WIDTH(430);
DEFINE_COM CLASS(#DEPTDESC.Visual) NAME(#DEPTDESC) DISPLAYPOSITION(8) HEIGHT(18) LEFT(211) MARGINLEFT(0) PARENT(#COM_OWNER) READONLY(True) TABPOSITION(9) TABSTOP(False) TOP(60) VISUALSTYLE(#VS_EMPH) WIDTH(206);
;
* This special button is hidden becaue it has a width of zero (but it could be shown okay) ;
;
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_1) BUTTONDEFAULT(True) CAPTION('Next Entry Field (Hidden Button)') DISPLAYPOSITION(6) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(7) TABSTOP(False) TOP(8) WIDTH(0);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#SAVE) CAPTION('Save Data') DISPLAYPOSITION(9) HEIGHT(24) LEFT(304) PARENT(#COM_OWNER) TABPOSITION(6) TOP(109);
;
* Simple work field to track and control the focus;
;
Define #FocusFld *Char 10;
;
* ===================;
* Form initialization;
* ===================;
;
EVTROUTINE HANDLING(#Com_Owner.Initialize) ;
Execute SetFocus (Salary);
ENDROUTINE;
;
* ==================================================;
* Handle user moving focus manually to another field;
* ================================================== ;
;
EVTROUTINE HANDLING(#SALARY.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS) ;
Change #FocusFld Salary ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYAVG.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryAvg ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#DEPTMENT.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld Deptment ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYMAX.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryMax ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYMIN.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryMin ;
ENDROUTINE;
;
* ================================;
* Set focus to current focus field;
* ================================;
;
Subroutine SetFocus ((#ToField *Received));
Define #ToField RefFld(#FocusFld);
;
Change #FocusFld #ToField;
;
Case #FocusFld;
when '= Salary';
invoke #Salary.Setfocus;
when '= SalaryAvg';
invoke #SalaryAvg.Setfocus;
when '= Deptment';
invoke #Deptment.Setfocus;
when '= SalaryMax';
invoke #SalaryMax.Setfocus;
when '= SalaryMin';
invoke #SalaryMin.Setfocus;
when '= Save';
Message 'Pressing Enter now will save information';
invoke #Save.Setfocus;
Endcase;
;
Endroutine ;
;
* ===========================;
* Advance focus to next field;
* ===========================;
;
Subroutine NextFocus;
;
Case #FocusFld;
when '= Salary';
Change #FocusFld SalaryAvg;
when '= Salaryavg';
Change #FocusFld Deptment;
when '= Deptment';
Change #FocusFld SalaryMax;
when '= SalaryMax';
Change #FocusFld SalaryMin;
when '= SalaryMin';
Change #FocusFld Save;
when '= Save';
Change #FocusFld Salary;
Endcase;
;
Execute SetFocus (#FocusFld);
;
Endroutine ;
;
* ================================================================;
* Button can be manually clicked or invoked by using any enter key;
* inside a field. Advances focus to the next field, but of course;
* logic could be changed to act differently for different fields. ;
* ================================================================;
;
EVTROUTINE HANDLING(#PHBN_1.Click);
Execute NextFocus;
ENDROUTINE;
;
* ==============================================;
* Handle individual field validations on the fly;
* ============================================== ;
;
* Salary;
;
EVTROUTINE HANDLING(#SALARY.LostFocus) ;
;
If '(#Salary < 10000) or (#Salary > 15000)' ;
Message 'Salary must be in range 10000 to 15000';
Execute SetFocus (Salary);
Endif ;
;
ENDROUTINE;
;
* Department;
;
EVTROUTINE HANDLING(#Deptment.LostFocus);
;
Change #Deptdesc Unknown;
Fetch (#Deptdesc) from_File(DepTab) With_Key(#deptment) ;
;
If_Status Is_Not(*Okay);
Message 'Department not found';
Execute SetFocus(Deptment);
Endif ;
;
ENDROUTINE;
;
* Minimum Salary;
;
EVTROUTINE HANDLING(#SALARYMIN.LostFocus) ;
;
If '(#SalaryMin < 1.01) or (#SalaryMin > 10.99)' ;
Message 'Minimum Salary must be in range 1.01 to 10.99';
Execute SetFocus (SalaryMin);
Endif ;
;
ENDROUTINE;
;
* ===================;
* Handle save request;
* =================== ;
;
EVTROUTINE HANDLING(#SAVE.Click);
;
Change (#Salary #SalaryAvg #Deptment #DeptDesc #SalaryMax #SalaryMin) *Null;
Message 'Information has been saved' ;
Execute SetFocus (Salary);
;
ENDROUTINE;
;
END_COM ;
Name: VL_SAM103
Description: The following RDMLX form is used to demonstrate some advanced high speed data entry techniques.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(200) LEFT(318) TOP(164) VISUALSTYLE(#VS_NORM) WIDTH(438);
;
* The form fields ;
;
DEFINE_COM CLASS(#SALARY.Visual) NAME(#SALARY) DISPLAYPOSITION(1) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(1) TOP(8) WIDTH(265);
DEFINE_COM CLASS(#SALARYAVG.Visual) NAME(#SALARYAVG) DISPLAYPOSITION(2) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(2) TOP(34) WIDTH(265);
DEFINE_COM CLASS(#DEPTMENT.Visual) NAME(#DEPTMENT) DISPLAYPOSITION(3) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(3) TOP(60);
DEFINE_COM CLASS(#SALARYMAX.Visual) NAME(#SALARYMAX) DISPLAYPOSITION(4) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(4) TOP(86) WIDTH(265);
DEFINE_COM CLASS(#SALARYMIN.Visual) NAME(#SALARYMIN) DISPLAYPOSITION(5) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(5) TOP(112) WIDTH(265);
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STBR_1) DISPLAYPOSITION(7) HEIGHT(22) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(8) TOP(151) WIDTH(430);
DEFINE_COM CLASS(#DEPTDESC.Visual) NAME(#DEPTDESC) DISPLAYPOSITION(8) HEIGHT(18) LEFT(211) MARGINLEFT(0) PARENT(#COM_OWNER) READONLY(True) TABPOSITION(9) TABSTOP(False) TOP(60) VISUALSTYLE(#VS_EMPH) WIDTH(206);
;
* This special button is hidden becaue it has a width of zero (but it could be shown okay) ;
;
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_1) BUTTONDEFAULT(True) CAPTION('Next Entry Field (Hidden Button)') DISPLAYPOSITION(6) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(7) TABSTOP(False) TOP(8) WIDTH(0);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#SAVE) CAPTION('Save Data') DISPLAYPOSITION(9) HEIGHT(24) LEFT(304) PARENT(#COM_OWNER) TABPOSITION(6) TOP(109);
;
* Simple work field to track and control the focus;
;
Define #FocusFld *Char 10;
;
* ===================;
* Form initialization;
* ===================;
;
EVTROUTINE HANDLING(#Com_Owner.Initialize) ;
Execute SetFocus (Salary);
ENDROUTINE;
;
* ==================================================;
* Handle user moving focus manually to another field;
* ================================================== ;
;
EVTROUTINE HANDLING(#SALARY.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS) ;
Change #FocusFld Salary ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYAVG.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryAvg ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#DEPTMENT.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld Deptment ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYMAX.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryMax ;
ENDROUTINE;
;
EVTROUTINE HANDLING(#SALARYMIN.GotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change #FocusFld SalaryMin ;
ENDROUTINE;
;
* ================================;
* Set focus to current focus field;
* ================================;
;
Subroutine SetFocus ((#ToField *Received));
Define #ToField RefFld(#FocusFld);
;
Change #FocusFld #ToField;
;
Case #FocusFld;
when '= Salary';
invoke #Salary.Setfocus;
when '= SalaryAvg';
invoke #SalaryAvg.Setfocus;
when '= Deptment';
invoke #Deptment.Setfocus;
when '= SalaryMax';
invoke #SalaryMax.Setfocus;
when '= SalaryMin';
invoke #SalaryMin.Setfocus;
when '= Save';
Message 'Pressing Enter now will save information';
invoke #Save.Setfocus;
Endcase;
;
Endroutine ;
;
* ===========================;
* Advance focus to next field;
* ===========================;
;
Subroutine NextFocus;
;
Case #FocusFld;
when '= Salary';
Change #FocusFld SalaryAvg;
when '= Salaryavg';
Change #FocusFld Deptment;
when '= Deptment';
Change #FocusFld SalaryMax;
when '= SalaryMax';
Change #FocusFld SalaryMin;
when '= SalaryMin';
Change #FocusFld Save;
when '= Save';
Change #FocusFld Salary;
Endcase;
;
Execute SetFocus (#FocusFld);
;
Endroutine ;
;
* ================================================================;
* Button can be manually clicked or invoked by using any enter key;
* inside a field. Advances focus to the next field, but of course;
* logic could be changed to act differently for different fields. ;
* ================================================================;
;
EVTROUTINE HANDLING(#PHBN_1.Click);
Execute NextFocus;
ENDROUTINE;
;
* ==============================================;
* Handle individual field validations on the fly;
* ============================================== ;
;
* Salary;
;
EVTROUTINE HANDLING(#SALARY.LostFocus) ;
;
If '(#Salary < 10000) or (#Salary > 15000)' ;
Message 'Salary must be in range 10000 to 15000';
Execute SetFocus (Salary);
Endif ;
;
ENDROUTINE;
;
* Department;
;
EVTROUTINE HANDLING(#Deptment.LostFocus);
;
Change #Deptdesc Unknown;
Fetch (#Deptdesc) from_File(DepTab) With_Key(#deptment) ;
;
If_Status Is_Not(*Okay);
Message 'Department not found';
Execute SetFocus(Deptment);
Endif ;
;
ENDROUTINE;
;
* Minimum Salary;
;
EVTROUTINE HANDLING(#SALARYMIN.LostFocus) ;
;
If '(#SalaryMin < 1.01) or (#SalaryMin > 10.99)' ;
Message 'Minimum Salary must be in range 1.01 to 10.99';
Execute SetFocus (SalaryMin);
Endif ;
;
ENDROUTINE;
;
* ===================;
* Handle save request;
* =================== ;
;
EVTROUTINE HANDLING(#SAVE.Click);
;
Change (#Salary #SalaryAvg #Deptment #DeptDesc #SalaryMax #SalaryMin) *Null;
Message 'Information has been saved' ;
Execute SetFocus (Salary);
;
ENDROUTINE;
;
END_COM ;