Dimensionsanzeige Formular in einem Formular hinzufügen
Today I will post about how to display only the inventory dimensions selected by the user.
This post is rather long because I decided show it step-by-step but I hope you guys enjoy it.
1. The table must have the field InventDimId and it must have a relation with InventDim.
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:
5. On class declaration add the following piece of code:
public class FormRun extends ObjectRun { // Declare the class InventDimCtrl_Frm_6. Now, create a new method in form.EditDimensions InventDimCtrl_Frm_ EditDimensions inventDimFormSetup; }
public InventDimCtrl_Frm_7. Override the form’s method Init.EditDimensions inventDimSetupObject() { return inventDimFormSetup; }
public void init() { super(); // This method will be used to show default fields at form startup element.updateDesign(8. Create a new method, this method is responsible to show the Inventory Controls.InventDimFormDesignUpdate:: Init); }
void updateDesign(9. We have to create a method on data source to update our table InventDimId and use the method Active to refresh the controls.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())); } }
Override Data source’s method Active.
public int active() { int ret; ret = super(); element.updateDesign(10. Now, override the method Modified for ItemId field in your data source.InventDimFormDesignUpdate:: Active); return ret; }
public void modified() { super(); element.updateDesign(11. We have to create a MenuItemButton to call the Display Dimension form where the user can select which dimensions he want to display.InventDimFormDesignUpdate:: FieldChange); InventDim.clearNotSelectedDim( element.inventDimSetupObject() .parmDimParmEnabled()); }
Set the following properties:
MenuItemType: Display
MenuItemName: InventDimParmFixed
12. By the end of this tutorial, your form should look like this.
13. The results:
Keine Kommentare:
Kommentar veröffentlichen