We have to follow some steps:
1.Create a table with two fields,
2. Create a new Form. My form has two data sources, InventDimDisplay and InventDim (required) and a grid.
![Image](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vNFFrosqLL-yuyv7etGfooO8x-2WijdrU0OTVyCwMvz8AX2JW3yYtXVUZN7HTwSL-Va_MPSAzx2WTesvSnNQC6jCIMr1hMnFpf0FA7laynQtm5A8B5QPbVVep-1dtNCTL1qjk=s0-d)
3.Set the InventDim data source properties to:-
![Image](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tup1h6pTQFOjeeZ0lRYRUdUEXA_GI-tzjVw1N3fn-1Fx6VYfuwZtk-4leS1FPpRnX0aInGuFi1XYhLej1f4GrX4mUfrCi-jlqRAD-hiGfeaK0iMC92itrhdmhdB_XDvkg_pa8=s0-d)
4.On form Design, create a new Grid and move the ItemId to your grid and then create a new Group and then set the properties below:
![Image](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uArnynCbZlw3VI6MpBrrcqsO3fj95_lopyIr0FVrhmxubq4WRkVuKwf6Na7ODYOLqn_4IO7WtprjFj9AEHLWyYza12iIOFiA4kQBuvbMmIPekZmA91RRkEE1sRQbkkeAvn_jU=s0-d)
On class declaration add the following piece of code:
Override Data source’s method Active.
MenuItemName: InventDimParmFixed
10. By the end of this tutorial, your form should look like this.
![Image](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vEFP096j7YbH2WEmFQJ0GzrZv_D51E7fq9UOj08M0RU921RxQgV6PIc4v1QmfZd3UXtoHRMe6f_-oQRV_rOJzicn6DCuG9cD4yYr9RUUBWG2ZsXk2fOuYxB_mOoiQG-e7k3so=s0-d)
11. The results:
![Image](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sx37y8fGqm-udu_wEU-TUXohO3wH6H48hvyT6f6FuJ3eRcnr6qmpQp0hVB-UYNtaaUAokqOkJaclM4TKywk-ZT6Iuh0i2p7SopZblCSl6SawPIp-RmjPxS-cth0jBdGmb4Qw=s0-d)
1.Create a table with two fields,
2. Create a new Form. My form has two data sources, InventDimDisplay and InventDim (required) and a grid.
3.Set the InventDim data source properties to:-
4.On form Design, create a new Grid and move the ItemId to your grid and then create a new Group and then set the properties below:
On class declaration add the following piece of code:
public class FormRun extends ObjectRun { // Declare the class InventDimCtrl_Frm_EditDimensions InventDimCtrl_Frm_EditDimensions inventDimFormSetup; }5. Now, create a new method in form.
public InventDimCtrl_Frm_EditDimensions inventDimSetupObject() { return inventDimFormSetup; }6. Override the form’s method Init.
public void init() { super(); // This method will be used to show default fields at form startup element.updateDesign(InventDimFormDesignUpdate::Init); }7. Create a new method, this method is responsible to show the Inventory Controls.
void updateDesign(InventDimFormDesignUpdate mode) { InventDimParm inventDimParmVisible; switch (mode) { // Form Init case InventDimFormDesignUpdate::Init : if (!inventDimFormSetup) inventDimFormSetup = InventDimCtrl_Frm_EditDimensions::newFromForm(element); inventDimFormSetup.parmSkipOnHandLookUp( true); // Use the methods on InventDimParm // to set which dimensions to show when form is initialized inventdimparmvisible.inventsiteidflag = true; inventdimparmvisible.InventLocationIdFlag = true; inventDimFormSetup.parmDimParmVisibleGrid(inventDimParmVisible); // Datasource Active case InventDimFormDesignUpdate::Active : inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(InventDimDisplay.ItemId)); //InventDimDisplay is the datasource name. inventDimFormSetup.formSetControls( true); break; // Datasource Field change case InventDimFormDesignUpdate::FieldChange : inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(InventDimDisplay.ItemId)); //InventDimDisplay is the datasource name. InventDim.clearNotSelectedDim(inventDimFormSetup.parmDimParmEnabled()); // InventDim is referring to datasource name inventDimFormSetup.formSetControls( true); break; default : throw error(strFmt ("@SYS54195", funcName())); } }8. We have to create a method on data source to update our table InventDimId and use the method Active to refresh the controls.
Override Data source’s method Active.
public int active() { int ret; ret = super(); element.updateDesign(InventDimFormDesignUpdate::Active); return ret; }9. Now, override the method Modified() for ItemId field in your data source.
public void modified() { super(); element.updateDesign(InventDimFormDesignUpdate::FieldChange); InventDim.clearNotSelectedDim(element.inventDimSetupObject().parmDimParmEnabled()); }
We have to create a MenuItemButton to call the Display Dimension form where the user can select which dimensions he want to display.
Set the following properties:
MenuItemType: DisplayMenuItemName: InventDimParmFixed
10. By the end of this tutorial, your form should look like this.
11. The results:
No comments:
Post a Comment