mercredi 29 décembre 2010

How to create a dialog when clicking a button in a form from X ++

To do this follow this example in the Clicked method of the Button:

 void clicked()
{
     InventDimCombination            InventDimCombination;
     Args                    args;
     FormRun                 _formRun;
     ;
     element.design().controlName("CustVendExternalItem_ItemId");



     dialog = new  Dialog();
     dialog.caption("@BFP2160");
     dialog.addGroup("@BFP2160");
     Vendrelation = dialog.addField(typeId(CustVendRelation));
     ExternalItemId = dialog.addField(typeId(ExternalItemId));

     if (dialog.run())
     {

     ttsbegin;
     while select forupdate custVendExternalItem
                                where
                            custVendExternalItem.ItemId == itemid
            custVendExternalItem.delete();
     ttscommit;

     custVendExternalItem_DS.refresh();
     custVendExternalItem_DS.research();
     custVendExternalItem_DS.reread();
         while select ItemId, inventDimId from InventDimCombination where InventDimCombination.ItemId == itemid
         {

            custVendExternalItem.ModuleType             = moduleType;
            custVendExternalItem.CustVendRelation       = custVendRelation;
            custVendExternalItem.ItemId = itemid;
            custVendExternalItem.inventDimId  = InventDimCombination.inventDimId;
            custVendExternalItem.CustVendRelation = Vendrelation.value();
            custVendExternalItem.ExternalItemId = ExternalItemId.value();
            custVendExternalItem.insert();
         }


         custVendExternalItem_DS.refresh();
         custVendExternalItem_DS.research();
         custVendExternalItem_DS.reread();
     }

     super();

}

Happy Daxing ! 

Aucun commentaire:

Enregistrer un commentaire