Index: VerpakkingsDefinitie/UI/ProductDetailScherm.pas =================================================================== diff -u -r585 -r586 --- VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 585) +++ VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 586) @@ -47,6 +47,15 @@ ButtonMeta: TButton; MemoParameters: TMemo; PanelVerpakkingControls: TPanel; + Label3: TLabel; + Button1: TButton; + EditVolumeVan: TEdit; + Label14: TLabel; + Label15: TLabel; + ComboBoxOptiType: TComboBox; + ComboBoxBoxSelect: TComboBox; + LabelProductNummer: TLabel; + Label17: TLabel; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -128,31 +137,39 @@ 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); VorigeIndexInList := ListViewVerpakkingen.ItemIndex; // List view (grid) + ListViewVerpakkingen.Items.BeginUpdate; ListViewVerpakkingen.Clear(); for ProductVerpakking in ApplicationContext.ProductDetailContext.ProductVerpakkingen do begin With ListViewVerpakkingen.Items.Add Do begin + Data := ProductVerpakking; // Caption := IntToStr(Product.ProductNr); // Deze casting geeft geen access violation - Caption := IntToStr(ProductVerpakking.CutOrder); - SubItems.Add(ProductVerpakking.MetaCaption); + Caption := intToStr(ProductVerpakking.CutOrder); + SubItems.Add(ProductVerpakking.MetaCaptionDisplay); SubItems.Add(ProductVerpakking.Breedte + ' x ' + ProductVerpakking.Diepte + ' x ' + ProductVerpakking.Hoogte); SubItems.Add(ProductVerpakking.Aantal); SubItems.Add(ProductVerpakking.MaxCombinAantal); - SubItems.Add(ifthen(ProductVerpakking.DeelVan <> nil, ProductVerpakking.DeelVan.MetaCaption, '')); - Data := ProductVerpakking; + if ProductVerpakking.DeelVan <> nil then + SubItems.Add(ProductVerpakking.DeelVanCaption) + else + SubItems.Add(''); + SubItems.Add(ProductVerpakking.ID); end; end; + 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] // Default eerste verpakking selecteren + ProductVerpakking := ApplicationContext.ProductDetailContext.ProductVerpakkingen[0] + // Default eerste verpakking selecteren else ProductVerpakking := nil; // Geen verpakking aanwezig @@ -170,7 +187,7 @@ begin // Linkerhelft - EditMeta.Text := ProductVerpakking.MetaCaption; + EditMeta.Text := ProductVerpakking.MetaCaptionDisplay; // DeelVan ComboBoxDeelVan.Items.Clear(); // ComboBox vullen en item selecteren. @@ -184,21 +201,24 @@ // Index zoeken in lijst van producten ComboBoxDeelVan.ItemIndex := ApplicationContext.ProductDetailContext.ProductVerpakkingen.IndexOf(ProductVerpakking.DeelVan) else + // Default waarde: 'niks' optie selecteren ComboBoxDeelVan.ItemIndex := ComboBoxDeelVan.Items.Count - 1; - // Default waarde: 'niks' optie selecteren + // Breedte, Diepte, Hoogte. + // Default waarde altijd als placeholder instellen + EditBreedte.TextHint := ProductVerpakking.DefaultBreedte; // Default if ProductVerpakking.Breedte <> '' then - EditBreedte.Text := ProductVerpakking.Breedte - else - EditBreedte.Text := ProductVerpakking.DefaultBreedte; // Default + EditBreedte.Text := ProductVerpakking.Breedte; + + EditDiepte.TextHint := ProductVerpakking.DefaultDiepte; // Default if ProductVerpakking.Diepte <> '' then - EditDiepte.Text := ProductVerpakking.Diepte - else - EditDiepte.Text := ProductVerpakking.DefaultDiepte; // Default + EditDiepte.Text := ProductVerpakking.Diepte; + + EditHoogte.TextHint := ProductVerpakking.DefaultHoogte; // Default if ProductVerpakking.Hoogte <> '' then - EditHoogte.Text := ProductVerpakking.Hoogte - else - EditHoogte.Text := ProductVerpakking.DefaultHoogte; + EditHoogte.Text := ProductVerpakking.Hoogte; + + // Max.Comb.Aantal, Aantal EditMaxCombAantal.Text := ProductVerpakking.MaxCombinAantal; EditAantal.Text := ProductVerpakking.Aantal; @@ -207,46 +227,62 @@ // Plaatsing ComboBoxPlaatsing.Items.Clear(); // Combobox vullen en item selecteren. Indien item niet aanwezig is, eerste item selecteren. - for Item in ApplicationContext.UiInstellingenContext.Plaatsing.Values do - begin - ComboBoxPlaatsing.Items.Add(Item); - end; - if (ApplicationContext.UiInstellingenContext.Plaatsing.TryGetValue(ProductVerpakking.Plaatsing, Item) = True) then + for Item in ApplicationContext.UiInstellingenContext.Plaatsing.keys do + ComboBoxPlaatsing.Items.AddObject(ApplicationContext.UiInstellingenContext.Plaatsing[Item], TObject(Item)); + if (ProductVerpakking.Plaatsing <> '') and + (ApplicationContext.UiInstellingenContext.Plaatsing.TryGetValue(ProductVerpakking.Plaatsing, Item) = True) then ComboBoxPlaatsing.ItemIndex := ComboBoxPlaatsing.Items.IndexOf(Item) + else if (ProductVerpakking.DefaultPlaatsing <> '') and + (ApplicationContext.UiInstellingenContext.Plaatsing.TryGetValue(ProductVerpakking.DefaultPlaatsing, Item) = True) then + ComboBoxPlaatsing.ItemIndex := ComboBoxPlaatsing.Items.IndexOf(Item) // Default else if ComboBoxPlaatsing.Items.Count > 0 then - ComboBoxPlaatsing.ItemIndex := 0; + ComboBoxPlaatsing.ItemIndex := 0; // Geen waarde, geen default, eerste item selecteren. // Positie CheckComboBoxPositie.Items.Clear(); - // CheckComboBox vullen en items selecteren. - { TODO : Vertaling naar gewone string waarden uit Context halen en tonen in checked combobox } - for Item in ApplicationContext.UiInstellingenContext.Positie.Keys do + // CheckComboBox vullen en items selecteren. Als waarde niet aanwezig is, uit default halen. + for Item in ApplicationContext.UiInstellingenContext.Posities.keys do + CheckComboBoxPositie.Items.AddObject(ApplicationContext.UiInstellingenContext.Posities[Item], TObject(Item)); + if ProductVerpakking.Posities.Count > 0 then begin - CheckComboBoxPositie.Items.Add(Item); - end; - if ProductVerpakking.Positie = '' then - // Lege positie betekent alles aangeduid - for I := 0 to CheckComboBoxPositie.Items.Count - 1 do - CheckComboBoxPositie.Checked[I] := True + for Item in ProductVerpakking.Posities do + begin + TempStr := ApplicationContext.UiInstellingenContext.Posities[Item]; + if CheckComboBoxPositie.Items.IndexOf(TempStr) >= 0 then + CheckComboBoxPositie.Checked[CheckComboBoxPositie.Items.IndexOf(TempStr)] := True; + end; + end else - for TempStr in SplitString(ProductVerpakking.Positie, '') do + // Default waarden + for Item in ProductVerpakking.DefaultPosities do + begin + TempStr := ApplicationContext.UiInstellingenContext.Posities[Item]; if CheckComboBoxPositie.Items.IndexOf(TempStr) >= 0 then CheckComboBoxPositie.Checked[CheckComboBoxPositie.Items.IndexOf(TempStr)] := True; + end; // Richting CheckComboBoxRichting.Items.Clear(); - // CheckComboBox vullen en item selecteren. Als waarde niet aanwezig is, uit default halen. - { TODO : Vertaling naar gewone string waarden uit Context halen en tonen in checked combobox } - for Item in ApplicationContext.UiInstellingenContext.Richting.Keys do + // CheckComboBox vullen en items selecteren. Als waarde niet aanwezig is, uit default halen. + for Item in ApplicationContext.UiInstellingenContext.Richtingen.keys do + CheckComboBoxRichting.Items.AddObject(ApplicationContext.UiInstellingenContext.Richtingen[Item], TObject(Item)); + if ProductVerpakking.Richtingen.Count > 0 then begin - CheckComboBoxRichting.Items.Add(Item); - end; - if ProductVerpakking.Richting <> '' then - begin - for TempStr in SplitString(ProductVerpakking.Richting, '') do + for Item in ProductVerpakking.Richtingen do + begin + TempStr := ApplicationContext.UiInstellingenContext.Richtingen[Item]; if CheckComboBoxRichting.Items.IndexOf(TempStr) >= 0 then CheckComboBoxRichting.Checked[CheckComboBoxRichting.Items.IndexOf(TempStr)] := True; - end; + end; + end + else + // Default waarden + for Item in ProductVerpakking.DefaultRichtingen do + begin + TempStr := ApplicationContext.UiInstellingenContext.Richtingen[Item]; + if CheckComboBoxRichting.Items.IndexOf(TempStr) >= 0 then + CheckComboBoxRichting.Checked[CheckComboBoxRichting.Items.IndexOf(TempStr)] := True; + end; end; procedure TFormProductDetail.UpdateControlsEnableStatus(); @@ -263,6 +299,8 @@ ButtonVerwijder.Enabled := VerpakkingAanwezigEnGeselecteerd; // Linkerdeel + EditMeta.Enabled := False; + EditVolumeVan.Enabled := False; ComboBoxDeelVan.Enabled := (ComboBoxDeelVan.Items.Count > 0) and VerpakkingAanwezigEnGeselecteerd; end;