Form S_202FCR
* ===================================================================;
*;
* Component : S_202FCR;
* Type : Form;
* Ancestor : PRIM_FORM (Primitive Form);
*;
* Description : Product Creator View;
*;
* This reusable component represents the creator "view" of a;
* "Product" for this simple MVC example.;
*;
* Disclaimer : The following material is supplied as example material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
Function Options(*DIRECT);
Begin_Com Caption('Product Creator') Formstyle(OwnedChild) Height(164) Layoutmanager(#FWLM_1) Left(408) Top(145) Visualstyle(#VS_NORM) Width(376);
Define_Com Class(#PRIM_FWLM) Name(#FWLM_1) Flowoperation(Center) Margintop(8) Spacing(4) Spacingitems(20);
Define_Com Class(#S_202NUM.Visual) Name(#S_202NUM) Displayposition(1) Height(19) Parent(#COM_OWNER) Tabposition(1) Top(11) Width(224);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_1) Manage(#S_202NUM) Parent(#FWLM_1);
Define_Com Class(#S_202DES.Visual) Name(#S_202DES) Displayposition(2) Height(19) Parent(#COM_OWNER) Tabposition(2) Top(34) Width(324);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_2) Manage(#S_202DES) Parent(#FWLM_1);
Define_Com Class(#S_202PRC.Visual) Name(#S_202PRC) Displayposition(3) Height(19) Parent(#COM_OWNER) Tabposition(3) Top(57) Width(247);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_3) Manage(#S_202PRC) Parent(#FWLM_1);
Define_Com Class(#S_202QTY.Visual) Name(#S_202QTY) Displayposition(4) Height(19) Parent(#COM_OWNER) Tabposition(4) Top(80) Width(224);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_4) Manage(#S_202QTY) Parent(#FWLM_1);
Define_Com Class(#PRIM_PHBN) Name(#SAVE_BUTTON) Buttondefault(True) Caption('Save Product') Displayposition(5) Enabled(False) Left(244) Parent(#COM_OWNER) Tabposition(5) Top(80);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_5) Manage(#SAVE_BUTTON) Parent(#FWLM_1);
Define_Com Class(#PRIM_STBR) Name(#STBR_1) Displayposition(6) Height(24) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(6) Tabstop(False) Top(113) Width(368);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_6) Manage(#STBR_1) Parent(#FWLM_1);
;
Def_Cond Name(*valid) Cond('(#S_202NUm > 0) and (#S_202Des *ne *Blanks) and (#S_202Prc > 0) ');
;
* Define an independent instance of the product controller;
;
Define_Com Class(#S_202RCO) Name(#PRODUCT_CONTROLLER);
;
* Define a reference to the shared product view;
;
Define_Com Class(#S_202RMO) Name(#PRODUCT_VIEW) Reference(*Dynamic);
;
* ===============================================================================;
* At initialization set up the reference to the shared product model;
* ===============================================================================;
;
Evtroutine Handling(#COM_OWNER.Initialize) Options(*NOCLEARMESSAGES *NOCLEARERRORS);
Set_Ref Com(#Product_View) To(#Product_Controller.ProductModel);
Endroutine;
;
* ===============================================================================;
* Handle a change to the number, description, price and quantity by setting the;
* save button's enablement according to the validity of the data. If the data is;
* invalid you cannot click on the save button.;
* ===============================================================================;
;
Evtroutine Handling(#S_202NUM.Changed #S_202DES.Changed #S_202PRC.Changed #S_202QTY.Changed) Options(*NOCLEARMESSAGES *NOCLEARERRORS);
Set Com(#Save_Button) Enabled(*Valid);
Endroutine;
;
* ===============================================================================;
* Handle a click on the save button;
* ===============================================================================;
;
Evtroutine Handling(#SAVE_BUTTON.Click);
Invoke Method(#Product_Controller.Insert) Number(#S_202NUM) Description(#S_202DES) Price(#S_202PRC) Available(#S_202QTY);
Endroutine;
;
* ===============================================================================;
* If a product was created, and it is the one being shown on this form, clear;
* the details, disable the save button and reset the focus ready to accept;
* details of the next product;
* ===============================================================================;
;
Evtroutine Handling(#PRODUCT_VIEW.ProductCreated) Number(#CS_202NUM) Description(#CS_202DES) Price(#CS_202PRC) Available(#CS_202QTY);
If Cond('#CS_202Num = #S_202Num');
Change Field(#S_202Num #S_202Des #S_202Qty #S_202Prc) To(*Null);
Set Com(#Save_Button) Enabled(False);
Invoke Method(#S_202Num.SetFocus);
Endif;
Endroutine;
;
End_Com;
* ===================================================================;
*;
* Component : S_202FCR;
* Type : Form;
* Ancestor : PRIM_FORM (Primitive Form);
*;
* Description : Product Creator View;
*;
* This reusable component represents the creator "view" of a;
* "Product" for this simple MVC example.;
*;
* Disclaimer : The following material is supplied as example material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
Function Options(*DIRECT);
Begin_Com Caption('Product Creator') Formstyle(OwnedChild) Height(164) Layoutmanager(#FWLM_1) Left(408) Top(145) Visualstyle(#VS_NORM) Width(376);
Define_Com Class(#PRIM_FWLM) Name(#FWLM_1) Flowoperation(Center) Margintop(8) Spacing(4) Spacingitems(20);
Define_Com Class(#S_202NUM.Visual) Name(#S_202NUM) Displayposition(1) Height(19) Parent(#COM_OWNER) Tabposition(1) Top(11) Width(224);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_1) Manage(#S_202NUM) Parent(#FWLM_1);
Define_Com Class(#S_202DES.Visual) Name(#S_202DES) Displayposition(2) Height(19) Parent(#COM_OWNER) Tabposition(2) Top(34) Width(324);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_2) Manage(#S_202DES) Parent(#FWLM_1);
Define_Com Class(#S_202PRC.Visual) Name(#S_202PRC) Displayposition(3) Height(19) Parent(#COM_OWNER) Tabposition(3) Top(57) Width(247);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_3) Manage(#S_202PRC) Parent(#FWLM_1);
Define_Com Class(#S_202QTY.Visual) Name(#S_202QTY) Displayposition(4) Height(19) Parent(#COM_OWNER) Tabposition(4) Top(80) Width(224);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_4) Manage(#S_202QTY) Parent(#FWLM_1);
Define_Com Class(#PRIM_PHBN) Name(#SAVE_BUTTON) Buttondefault(True) Caption('Save Product') Displayposition(5) Enabled(False) Left(244) Parent(#COM_OWNER) Tabposition(5) Top(80);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_5) Manage(#SAVE_BUTTON) Parent(#FWLM_1);
Define_Com Class(#PRIM_STBR) Name(#STBR_1) Displayposition(6) Height(24) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(6) Tabstop(False) Top(113) Width(368);
Define_Com Class(#PRIM_FWLI) Name(#FWLI_6) Manage(#STBR_1) Parent(#FWLM_1);
;
Def_Cond Name(*valid) Cond('(#S_202NUm > 0) and (#S_202Des *ne *Blanks) and (#S_202Prc > 0) ');
;
* Define an independent instance of the product controller;
;
Define_Com Class(#S_202RCO) Name(#PRODUCT_CONTROLLER);
;
* Define a reference to the shared product view;
;
Define_Com Class(#S_202RMO) Name(#PRODUCT_VIEW) Reference(*Dynamic);
;
* ===============================================================================;
* At initialization set up the reference to the shared product model;
* ===============================================================================;
;
Evtroutine Handling(#COM_OWNER.Initialize) Options(*NOCLEARMESSAGES *NOCLEARERRORS);
Set_Ref Com(#Product_View) To(#Product_Controller.ProductModel);
Endroutine;
;
* ===============================================================================;
* Handle a change to the number, description, price and quantity by setting the;
* save button's enablement according to the validity of the data. If the data is;
* invalid you cannot click on the save button.;
* ===============================================================================;
;
Evtroutine Handling(#S_202NUM.Changed #S_202DES.Changed #S_202PRC.Changed #S_202QTY.Changed) Options(*NOCLEARMESSAGES *NOCLEARERRORS);
Set Com(#Save_Button) Enabled(*Valid);
Endroutine;
;
* ===============================================================================;
* Handle a click on the save button;
* ===============================================================================;
;
Evtroutine Handling(#SAVE_BUTTON.Click);
Invoke Method(#Product_Controller.Insert) Number(#S_202NUM) Description(#S_202DES) Price(#S_202PRC) Available(#S_202QTY);
Endroutine;
;
* ===============================================================================;
* If a product was created, and it is the one being shown on this form, clear;
* the details, disable the save button and reset the focus ready to accept;
* details of the next product;
* ===============================================================================;
;
Evtroutine Handling(#PRODUCT_VIEW.ProductCreated) Number(#CS_202NUM) Description(#CS_202DES) Price(#CS_202PRC) Available(#CS_202QTY);
If Cond('#CS_202Num = #S_202Num');
Change Field(#S_202Num #S_202Des #S_202Qty #S_202Prc) To(*Null);
Set Com(#Save_Button) Enabled(False);
Invoke Method(#S_202Num.SetFocus);
Endif;
Endroutine;
;
End_Com;