Index: VerpakkingsDefinitie/UI/ProductDetailScherm.pas =================================================================== diff -u -r590 -r591 --- VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 590) +++ VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 591) @@ -122,11 +122,13 @@ procedure TFormProductDetail.UpdateGui(Sender: TObject); var + GeselecteerdProduct: TProductInformatie; ProductVerpakking: TProductVerpakking; VorigeIndexInList: Integer; begin - if (ApplicationContext.ProductDetailContext.GeselecteerdProduct = nil) or - (ApplicationContext.ProductDetailContext.ProductVerpakkingen.Count = 0) then + GeselecteerdProduct := ApplicationContext.ProductsContext.GeselecteerdProduct; + if (GeselecteerdProduct = nil) or + (ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count = 0) then begin UpdateGuiDataAanwezigheid(False); exit; @@ -135,17 +137,17 @@ UpdateGuiDataAanwezigheid(True); // Update met data uit ApplicationContext - LabelOmschrijving1.Caption := ApplicationContext.ProductDetailContext.GeselecteerdProduct.Omschrijving1; - LabelOmschrijving2.Caption := ApplicationContext.ProductDetailContext.GeselecteerdProduct.Omschrijving2; - LabelProductNaam.Caption := ApplicationContext.ProductDetailContext.GeselecteerdProduct.Kol1; - LabelProductNummer.Caption := intToStr(ApplicationContext.ProductDetailContext.GeselecteerdProduct.ProductNr); + LabelOmschrijving1.Caption := GeselecteerdProduct.Omschrijving1; + LabelOmschrijving2.Caption := GeselecteerdProduct.Omschrijving2; + LabelProductNaam.Caption := GeselecteerdProduct.Kol1; + LabelProductNummer.Caption := intToStr(GeselecteerdProduct.ProductNr); VorigeIndexInList := ListViewVerpakkingen.ItemIndex; // List view (grid) ListViewVerpakkingen.Items.BeginUpdate; ListViewVerpakkingen.Clear(); - for ProductVerpakking in ApplicationContext.ProductDetailContext.ProductVerpakkingen do + for ProductVerpakking in ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen do begin With ListViewVerpakkingen.Items.Add Do begin @@ -166,10 +168,10 @@ ListViewVerpakkingen.Items.EndUpdate; // Kijk of dezelfde verpakking als voor de update opnieuw geselecteerd kan worden - if (VorigeIndexInList >= 0) and (VorigeIndexInList < ApplicationContext.ProductDetailContext.ProductVerpakkingen.Count) then - ProductVerpakking := ApplicationContext.ProductDetailContext.ProductVerpakkingen[VorigeIndexInList] - else if ApplicationContext.ProductDetailContext.ProductVerpakkingen.Count > 0 then - ProductVerpakking := ApplicationContext.ProductDetailContext.ProductVerpakkingen[0] + if (VorigeIndexInList >= 0) and (VorigeIndexInList < ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count) then + ProductVerpakking := ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen[VorigeIndexInList] + else if ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count > 0 then + ProductVerpakking := ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen[0] // Default eerste verpakking selecteren else ProductVerpakking := nil; // Geen verpakking aanwezig @@ -182,7 +184,6 @@ procedure TFormProductDetail.ToonProductVerpakking(ProductVerpakking: TProductVerpakking); var - TempStr: string; Item: string; Parameter: TProductVerpakkingParameter; NieuweParameterControl: TCustomPanelVerpakkingParameter; @@ -195,15 +196,16 @@ // DeelVan ComboBoxDeelVan.Items.Clear(); // ComboBox vullen en item selecteren. - for TempStr in ApplicationContext.ProductDetailContext.GetDeelVanOpties(ProductVerpakking) do + for Item in ApplicationContext.ProductVerpakkingContext.GetDeelVanOpties(ProductVerpakking) do begin - ComboBoxDeelVan.Items.Add(TempStr); + ComboBoxDeelVan.Items.Add(Item); end; ComboBoxDeelVan.Items.Add(NERGENS_DEEL_VAN_CAPTION); // Item selecteren if ProductVerpakking.DeelVan <> nil then // Index zoeken in lijst van producten - ComboBoxDeelVan.ItemIndex := ApplicationContext.ProductDetailContext.ProductVerpakkingen.IndexOf(ProductVerpakking.DeelVan) + ComboBoxDeelVan.ItemIndex := ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.IndexOf + (ProductVerpakking.DeelVan) else // Default waarde: 'niks' optie selecteren ComboBoxDeelVan.ItemIndex := ComboBoxDeelVan.Items.Count - 1;