| Quintiq file version 2.0 | 
| #parent: #root | 
| Method OnOK () id:Method_DialogCreateEditIngredient_OnOK | 
| { | 
|   #keys: '[135040.0.183113912]' | 
|   Body: | 
|   [* | 
|     // When the user clicks ok,  | 
|     // we either create or edit the data | 
|     //this.ApplyChanges(); | 
|      | 
|     data := DataHolderDialogData.Data(); | 
|      | 
|     if( isnull( data.WrappedInstance() ) ) | 
|     { | 
|       newingredient := Ingredient::Create( MacroPlan, | 
|                                            edtName.Text(), | 
|                                            edtDescription.Text(), false); | 
|       // Access the form, select the new ingredient | 
|       DataHolderForm.Data().ListIngredient().SelectByKey( newingredient.Key() );                         | 
|     } | 
|     else | 
|     { | 
|       data.WrappedInstance().Update( edtName.Text(), | 
|                                      edtDescription.Text(), | 
|                                      false ); | 
|     } | 
|                                  | 
|     this.Close(); | 
|   *] | 
| } |