Index: VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm (.../GevondenProductenScherm.dfm) (revision 593) +++ VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm (.../GevondenProductenScherm.dfm) (revision 594) @@ -55,8 +55,5 @@ TabOrder = 0 ViewStyle = vsReport OnSelectItem = ListViewProductenSelectItem - ExplicitLeft = -4 - ExplicitWidth = 325 - ExplicitHeight = 490 end end Index: VerpakkingsDefinitie/UI/ProductDetailScherm.dfm =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/ProductDetailScherm.dfm (.../ProductDetailScherm.dfm) (revision 593) +++ VerpakkingsDefinitie/UI/ProductDetailScherm.dfm (.../ProductDetailScherm.dfm) (revision 594) @@ -1,10 +1,12 @@ object FormProductDetail: TFormProductDetail Left = 0 Top = 0 + BorderStyle = bsNone Caption = 'FormProductDetail' - ClientHeight = 679 - ClientWidth = 802 + ClientHeight = 240 + ClientWidth = 818 Color = clBtnFace + Constraints.MinHeight = 240 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 @@ -14,8 +16,8 @@ OnCreate = FormCreate OnDestroy = FormDestroy DesignSize = ( - 802 - 679) + 818 + 240) PixelsPerInch = 96 TextHeight = 13 object LabelOmschrijving1: TLabel @@ -65,7 +67,7 @@ ParentFont = False end object LabelProductNummer: TLabel - Left = 730 + Left = 746 Top = 64 Width = 122 Height = 13 @@ -79,238 +81,33 @@ Font.Style = [fsBold] ParentBiDiMode = False ParentFont = False + ExplicitLeft = 730 end object Label17: TLabel - Left = 670 + Left = 686 Top = 64 Width = 54 Height = 13 Anchors = [akTop, akRight] Caption = 'Product nr.' ExplicitLeft = 676 end - object PanelVerpakkingControls: TPanel - Left = 2 - Top = 259 - Width = 792 - Height = 416 - Anchors = [akLeft, akBottom] - BevelOuter = bvNone - TabOrder = 1 - object Label10: TLabel - Left = 8 - Top = 271 - Width = 55 - Height = 13 - Caption = 'Parameters' - end - object Label11: TLabel - Left = 360 - Top = 79 - Width = 43 - Height = 13 - Caption = 'Plaatsing' - end - object Label12: TLabel - Left = 360 - Top = 111 - Width = 31 - Height = 13 - Caption = 'Positie' - end - object Label13: TLabel - Left = 360 - Top = 143 - Width = 38 - Height = 13 - Caption = 'Richting' - end - object Label2: TLabel - Left = 8 - Top = 15 - Width = 24 - Height = 13 - Caption = 'Meta' - end - object Label4: TLabel - Left = 8 - Top = 79 - Width = 42 - Height = 13 - Caption = 'Deel van' - end - object Label5: TLabel - Left = 8 - Top = 111 - Width = 38 - Height = 13 - Caption = 'Breedte' - end - object Label6: TLabel - Left = 8 - Top = 143 - Width = 31 - Height = 13 - Caption = 'Diepte' - end - object Label7: TLabel - Left = 8 - Top = 175 - Width = 35 - Height = 13 - Caption = 'Hoogte' - end - object Label8: TLabel - Left = 8 - Top = 207 - Width = 85 - Height = 13 - Caption = 'Max comb. aantal' - end - object Label9: TLabel - Left = 8 - Top = 239 - Width = 31 - Height = 13 - Caption = 'Aantal' - end - object Label3: TLabel - Left = 8 - Top = 47 - Width = 55 - Height = 13 - Caption = 'Volume van' - end - object Label14: TLabel - Left = 360 - Top = 207 - Width = 44 - Height = 13 - Caption = 'OptiType' - end - object ButtonMeta: TButton - Left = 272 - Top = 12 - Width = 40 - Height = 21 - Caption = '...' - TabOrder = 0 - end - object ComboBoxDeelVan: TComboBox - Left = 112 - Top = 76 - Width = 200 - Height = 21 - Style = csDropDownList - TabOrder = 1 - end - object ComboBoxPlaatsing: TComboBox - Left = 464 - Top = 76 - Width = 162 - Height = 21 - Style = csDropDownList - TabOrder = 2 - end - object ComboBoxPositie: TComboBox - Left = 464 - Top = 108 - Width = 162 - Height = 21 - Style = csDropDownList - TabOrder = 3 - end - object ComboBoxRichting: TComboBox - Left = 464 - Top = 140 - Width = 162 - Height = 21 - Style = csDropDownList - TabOrder = 4 - end - object EditAantal: TEdit - Left = 112 - Top = 236 - Width = 200 - Height = 21 - TabOrder = 5 - end - object EditBreedte: TEdit - Left = 112 - Top = 108 - Width = 200 - Height = 21 - TabOrder = 6 - end - object EditDiepte: TEdit - Left = 112 - Top = 140 - Width = 200 - Height = 21 - TabOrder = 7 - end - object EditHoogte: TEdit - Left = 112 - Top = 172 - Width = 200 - Height = 21 - TabOrder = 8 - end - object EditMaxCombAantal: TEdit - Left = 112 - Top = 204 - Width = 200 - Height = 21 - TabOrder = 9 - end - object EditMeta: TEdit - Left = 112 - Top = 12 - Width = 154 - Height = 21 - Enabled = False - TabOrder = 10 - end - object EditVolumeVan: TEdit - Left = 112 - Top = 44 - Width = 154 - Height = 21 - Enabled = False - TabOrder = 11 - end - object ComboBoxOptiType: TComboBox - Left = 464 - Top = 204 - Width = 162 - Height = 21 - Style = csDropDownList - TabOrder = 12 - end - object ScrollBoxParameters: TScrollBox - Left = 112 - Top = 268 - Width = 200 - Height = 125 - TabOrder = 13 - end - end object GroupBox1: TGroupBox Left = 8 Top = 83 - Width = 786 - Height = 170 + Width = 802 + Height = 150 Anchors = [akLeft, akTop, akRight, akBottom] Caption = 'Dozen' TabOrder = 0 DesignSize = ( - 786 - 170) + 802 + 150) object ListViewVerpakkingen: TListView Left = 3 Top = 16 - Width = 663 - Height = 151 + Width = 679 + Height = 131 Anchors = [akLeft, akTop, akRight, akBottom] Columns = < item @@ -356,24 +153,28 @@ TabOrder = 0 ViewStyle = vsReport OnSelectItem = ListViewVerpakkingenSelectItem + ExplicitWidth = 663 + ExplicitHeight = 151 end object ButtonNieuw: TButton - Left = 682 - Top = 49 + Left = 698 + Top = 31 Width = 101 Height = 25 - Anchors = [akRight, akBottom] + Anchors = [akTop, akRight] Caption = 'Nieuw' TabOrder = 1 + ExplicitLeft = 682 end object ButtonVerwijder: TButton - Left = 682 - Top = 88 + Left = 698 + Top = 70 Width = 101 Height = 25 - Anchors = [akRight, akBottom] + Anchors = [akTop, akRight] Caption = 'Verwijder' TabOrder = 2 + ExplicitLeft = 682 end end end Index: VerpakkingsDefinitie/WS/ProductsAgent.pas =================================================================== diff -u -r591 -r594 --- VerpakkingsDefinitie/WS/ProductsAgent.pas (.../ProductsAgent.pas) (revision 591) +++ VerpakkingsDefinitie/WS/ProductsAgent.pas (.../ProductsAgent.pas) (revision 594) @@ -26,19 +26,19 @@ function GeefBruikbareLijnenUitXMLDataSet(DataSetXml: string): TStringList; procedure RegistreerZoekResultaten(ProductsContext: TProductsContext; DataSet: string); overload; procedure RegistreerMislukteOpzoeking(ProductsContext: TProductsContext; pxStatusObj: SelectService.pxStatus); overload; - procedure RegistreerZoekResultaten(ProductDetailContext: TProductVerpakkingContext; + procedure RegistreerZoekResultaten(ProductVerpakkingenContext: TProductVerpakkingenContext; pxBoxDataObj: OptiServerService.pxBoxData); overload; - procedure RegistreerMislukteOpzoeking(ProductDetailContext: TProductVerpakkingContext; + procedure RegistreerMislukteOpzoeking(ProductDetailContext: TProductVerpakkingenContext; pxStatusObj: OptiServerService.pxStatus); overload; - function GetBoxDataIDsViaProduct(ProductNr: Integer; UserContext: TUserContext; ProductDetailContext: TProductVerpakkingContext) + function GetBoxDataIDsViaProduct(ProductNr: Integer; UserContext: TUserContext; ProductDetailContext: TProductVerpakkingenContext) : TList; public Constructor Create(); procedure LaadUIInstellingen(UserContext: TUserContext; UiInstellingenContext: TUiInstellingenContext); procedure ZoekOp(UserContext: TUserContext; ProductsContext: TProductsContext; Zoekmethode: TZoekMethode; Zoek: string; KLNr: string; LevNr: string; StockType: string; Taal: string); - procedure ZoekProductDataMetProductNr(ProductNr: Integer; UserContext: TUserContext; - ProductDetailContext: TProductVerpakkingContext); + procedure ZoekProductVerpakkingenMetProductNr(ProductNr: Integer; UserContext: TUserContext; + ProductDetailContext: TProductVerpakkingenContext); end; implementation @@ -336,7 +336,7 @@ end; function TProductsAgent.GetBoxDataIDsViaProduct(ProductNr: Integer; UserContext: TUserContext; - ProductDetailContext: TProductVerpakkingContext): TList; + ProductDetailContext: TProductVerpakkingenContext): TList; var ZoekData: OptiServerService.GetBoxDataIDsViaProduct; GetBoxDataIDsViaProductResponseObj: OptiServerService.GetBoxDataIDsViaProductResponse; @@ -409,8 +409,8 @@ end; end; -procedure TProductsAgent.ZoekProductDataMetProductNr(ProductNr: Integer; UserContext: TUserContext; - ProductDetailContext: TProductVerpakkingContext); +procedure TProductsAgent.ZoekProductVerpakkingenMetProductNr(ProductNr: Integer; UserContext: TUserContext; + ProductDetailContext: TProductVerpakkingenContext); var ZoekData: OptiServerService.GetBoxDataViaId; BoxDataIDs: TList; @@ -462,23 +462,24 @@ ProductVerpakking.DeelVan := ProductVerpakkingAndere; end; ProductDetailContext.NotifyChanged(); + finally FreeAndNil(BoxDataIDs); FreeAndNil(ZoekData); end; end; -procedure TProductsAgent.RegistreerZoekResultaten(ProductDetailContext: TProductVerpakkingContext; +procedure TProductsAgent.RegistreerZoekResultaten(ProductVerpakkingenContext: TProductVerpakkingenContext; pxBoxDataObj: OptiServerService.pxBoxData); var Verpakking: TProductVerpakking; I: Integer; NieuweVerpakkingParameter: TProductVerpakkingParameter; begin // Andere velden juist zetten - ProductDetailContext.IsOK := True; - ProductDetailContext.ErrorMessage := ''; - ProductDetailContext.InternalErrorMessage := ''; + ProductVerpakkingenContext.IsOK := True; + ProductVerpakkingenContext.ErrorMessage := ''; + ProductVerpakkingenContext.InternalErrorMessage := ''; Verpakking := TProductVerpakking.Create(); with Verpakking do @@ -530,10 +531,10 @@ MetaCaption := pxBoxDataObj.MetaCaption; end; - ProductDetailContext.ProductVerpakkingen.Add(Verpakking); + ProductVerpakkingenContext.ProductVerpakkingen.Add(Verpakking); end; -procedure TProductsAgent.RegistreerMislukteOpzoeking(ProductDetailContext: TProductVerpakkingContext; +procedure TProductsAgent.RegistreerMislukteOpzoeking(ProductDetailContext: TProductVerpakkingenContext; pxStatusObj: OptiServerService.pxStatus); begin ProductDetailContext.ProductVerpakkingen.Clear(); Index: VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm =================================================================== diff -u -r592 -r594 --- VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm (.../ZoekProductenScherm.dfm) (revision 592) +++ VerpakkingsDefinitie/UI/ZoekProductenScherm.dfm (.../ZoekProductenScherm.dfm) (revision 594) @@ -23,7 +23,7 @@ Top = 0 Width = 361 Height = 204 - ActivePage = TabSheetKortTekst + ActivePage = TabSheetTekst Anchors = [akLeft, akTop, akRight, akBottom] Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -34,6 +34,9 @@ TabOrder = 0 object TabSheetKortTekst: TTabSheet Caption = '(K) Kort tekst' + DesignSize = ( + 353 + 176) object Label1: TLabel Left = 3 Top = 10 @@ -53,6 +56,7 @@ Top = 7 Width = 289 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 0 OnChange = EditZoekKortTekstChange end @@ -74,6 +78,7 @@ Top = 69 Width = 289 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 2 end object ButtonZoekViaKortTekst: TButton @@ -96,10 +101,9 @@ object TabSheetIdentificatieNr: TTabSheet Caption = '(I) Identificatie nr' ImageIndex = 1 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 + DesignSize = ( + 353 + 176) object Label3: TLabel Left = 3 Top = 10 @@ -112,6 +116,7 @@ Top = 7 Width = 289 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 0 OnChange = EditZoekIdentNrChange end @@ -135,10 +140,9 @@ object TabSheetLeveranciersRef: TTabSheet Caption = '(R) Leveranciers ref' ImageIndex = 2 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 + DesignSize = ( + 353 + 176) object Label4: TLabel Left = 3 Top = 10 @@ -165,6 +169,7 @@ Top = 7 Width = 225 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 0 OnChange = EditReferentieChange end @@ -173,6 +178,7 @@ Top = 42 Width = 225 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 1 TextHint = 'Klant nr' OnChange = EditReferentieChange @@ -183,6 +189,7 @@ Width = 225 Height = 21 Style = csDropDownList + Anchors = [akLeft, akTop, akRight] TabOrder = 2 Items.Strings = ( '--Niet gespecifieerd--' @@ -210,10 +217,9 @@ object TabSheetTekst: TTabSheet Caption = '(T) Tekst' ImageIndex = 3 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 + DesignSize = ( + 353 + 176) object Label7: TLabel Left = 3 Top = 10 @@ -240,6 +246,7 @@ Top = 7 Width = 289 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 0 OnChange = EditZoekTekstChange end @@ -276,6 +283,7 @@ Top = 104 Width = 289 Height = 21 + Anchors = [akLeft, akTop, akRight] TabOrder = 3 end object ButtonZoekTekst: TButton Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dproj =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 593) +++ VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 594) @@ -125,6 +125,10 @@ dfm + +
FormVerpakkingDetail
+ dfm +
Cfg_2 Base Index: VerpakkingsDefinitie/ApplicationContext.pas =================================================================== diff -u -r591 -r594 --- VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 591) +++ VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 594) @@ -200,7 +200,7 @@ constructor Create(); end; - TProductVerpakkingContext = class(TSubject) + TProductVerpakkingenContext = class(TSubject) private FProductVerpakkingen: TList; FGeselecteerdeVerpakking: TProductVerpakking; @@ -231,13 +231,13 @@ FUserContext: TUserContext; FUiInstellingenContext: TUiInstellingenContext; FProductsContext: TProductsContext; - FProductDetailContext: TProductVerpakkingContext; + FProductDetailContext: TProductVerpakkingenContext; public constructor Create(); property UserContext: TUserContext read FUserContext write FUserContext; property UiInstellingenContext: TUiInstellingenContext read FUiInstellingenContext write FUiInstellingenContext; property ProductsContext: TProductsContext read FProductsContext write FProductsContext; - property ProductVerpakkingContext: TProductVerpakkingContext read FProductDetailContext write FProductDetailContext; + property ProductVerpakkingContext: TProductVerpakkingenContext read FProductDetailContext write FProductDetailContext; end; implementation @@ -326,18 +326,18 @@ end; // PRODUCT DETAIL -constructor TProductVerpakkingContext.Create; +constructor TProductVerpakkingenContext.Create; begin inherited Create(); FProductVerpakkingen := TList.Create(); end; -procedure TProductVerpakkingContext.NotifyChanged(); +procedure TProductVerpakkingenContext.NotifyChanged(); begin self.Change(); end; -procedure TProductVerpakkingContext.Reset(); +procedure TProductVerpakkingenContext.Reset(); begin if (FGeselecteerdeVerpakking <> nil) or (FProductVerpakkingen.Count > 0) then begin @@ -347,7 +347,7 @@ end; end; -function TProductVerpakkingContext.GetDeelVanOpties(ProductVerpakking: TProductVerpakking): TList; +function TProductVerpakkingenContext.GetDeelVanOpties(ProductVerpakking: TProductVerpakking): TList; var ProductVerpakkingTeZoeken: TProductVerpakking; Namen: TList; @@ -401,7 +401,7 @@ FUserContext := TUserContext.Create(); FUiInstellingenContext := TUiInstellingenContext.Create(); FProductsContext := TProductsContext.Create(); - FProductDetailContext := TProductVerpakkingContext.Create(); + FProductDetailContext := TProductVerpakkingenContext.Create(); end; end. Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dpr =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 593) +++ VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 594) @@ -21,7 +21,8 @@ UI_Data in 'WS\UI_Data.pas', CustomPanelVerpakkingParameter in 'UI\CustomPanelVerpakkingParameter.pas', NavProductScherm in 'UI\NavProductScherm.pas' {FormProductNav}, - Navigator in 'UI\Navigator.pas'; + Navigator in 'UI\Navigator.pas', + VerpakkingDetailScherm in 'UI\VerpakkingDetailScherm.pas' {FormVerpakkingDetail}; {$R *.res} Index: VerpakkingsDefinitie/UI/NavProductScherm.pas =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/NavProductScherm.pas (.../NavProductScherm.pas) (revision 593) +++ VerpakkingsDefinitie/UI/NavProductScherm.pas (.../NavProductScherm.pas) (revision 594) @@ -28,7 +28,7 @@ uses Util, - ZoekProductenScherm, GebruikerScherm, GevondenProductenScherm, ProductDetailScherm; + ZoekProductenScherm, GebruikerScherm, GevondenProductenScherm, ProductDetailScherm, VerpakkingDetailScherm; constructor TFormProductNav.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; UserAgent: TUserAgent; ProductsAgent: TProductsAgent); @@ -70,10 +70,13 @@ begin // Geen nieuw grid plaatsen wanneer er al een aanwezig is if GridPanelRight.ControlCount = 0 then + begin // Vul rechtergrid TUtil.PlaatsControlOpGrid(GridPanelRight, TFormProductDetail.Create(GridPanelRight, self, ApplicationContext, - ApplicationContext.ProductVerpakkingContext), 0, 0, 2); - + ApplicationContext.ProductsContext, FProductsAgent), 0, 0); + TUtil.PlaatsControlOpGrid(GridPanelRight, TFormVerpakkingDetail.Create(GridPanelRight, self, ApplicationContext, + ApplicationContext.ProductVerpakkingContext), 1, 0); + end; end; NAVTOONPRODUCTVERPAKKING: begin Index: VerpakkingsDefinitie/UI/GevondenProductenScherm.pas =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/GevondenProductenScherm.pas (.../GevondenProductenScherm.pas) (revision 593) +++ VerpakkingsDefinitie/UI/GevondenProductenScherm.pas (.../GevondenProductenScherm.pas) (revision 594) @@ -54,31 +54,16 @@ end; procedure TFormGevondenProducten.ListViewProductenSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); -var - ErrorMessage: string; begin if (Selected = false) or (Item = nil) or (Item.Data = nil) then exit; + // Product selectie registreren. Observatie uitzetten want dit scherm zet de selectie, reageert er niet op. + self.FSubjectObserver.Enabled := false; ApplicationContext.ProductsContext.GeselecteerdProduct := Item.Data; - // ApplicationContext.ProductDetailContext.NotifyChanged(); - FProductsAgent.ZoekProductDataMetProductNr(TProductInformatie(Item.Data).ProductNr, self.ApplicationContext.UserContext, - self.ApplicationContext.ProductVerpakkingContext); + ApplicationContext.ProductsContext.NotifyChanged(); { TODO : Vervangen door notify changed in setter } + self.FSubjectObserver.Enabled := True; - if self.ApplicationContext.ProductVerpakkingContext.IsOK then - // Gelukt - Navigator.NavigeerNaar(NAVTOONPRODUCT) - else - begin - // Opzoeking gefaald - ErrorMessage := self.ApplicationContext.ProductVerpakkingContext.ErrorMessage; - if self.ApplicationContext.ProductVerpakkingContext.InternalErrorMessage <> '' then - begin - ErrorMessage := ErrorMessage + sLineBreak + self.ApplicationContext.ProductVerpakkingContext.InternalErrorMessage; - end; - - MessageDlg(ErrorMessage, TMsgDlgType.mtInformation, [mbOK], 0, mbCancel); - self.ApplicationContext.ProductVerpakkingContext.Reset(); - end; + self.Navigator.NavigeerNaar(NAVTOONPRODUCT); end; procedure TFormGevondenProducten.UpdateGui(Sender: TObject); Index: VerpakkingsDefinitie/UI/VerpakkingDetailScherm.pas =================================================================== diff -u --- VerpakkingsDefinitie/UI/VerpakkingDetailScherm.pas (revision 0) +++ VerpakkingsDefinitie/UI/VerpakkingDetailScherm.pas (revision 594) @@ -0,0 +1,264 @@ +unit VerpakkingDetailScherm; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.CheckLst, + System.Generics.Collections, + Subscherm, Navigator, + ApplicationContext, + ObserverPattern, + CheckCombo; + +Resourcestring + NERGENS_DEEL_VAN_CAPTION = '--Nergens deel van--'; + +type + TFormVerpakkingDetail = class(TFormSubscherm) + PanelVerpakkingControls: TPanel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label2: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label3: TLabel; + Label14: TLabel; + ButtonMeta: TButton; + ComboBoxDeelVan: TComboBox; + ComboBoxPlaatsing: TComboBox; + ComboBoxPositie: TComboBox; + ComboBoxRichting: TComboBox; + EditAantal: TEdit; + EditBreedte: TEdit; + EditDiepte: TEdit; + EditHoogte: TEdit; + EditMaxCombAantal: TEdit; + EditMeta: TEdit; + EditVolumeVan: TEdit; + ComboBoxOptiType: TComboBox; + ScrollBoxParameters: TScrollBox; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + private + FProductVerpakkingSubject: TSubject; + FProductVerpakkingSubjectObserver: TSubjectObserver; + + CheckComboBoxPositie: TCheckedComboBox; + CheckComboBoxRichting: TCheckedComboBox; + + procedure LaadCheckedComboBoxen(); + procedure UpdateGui(Sender: TObject); + procedure ToonProductVerpakking(ProductVerpakking: TProductVerpakking); + procedure UpdateControlsEnableStatus(); + procedure LaadEnSelecteerWaardenComboBox(Waarden: TDictionary; ComboBox: TComboBox; + GeselecteerdeWaarde: string; DefaultGeselecteerdeWaarde: string; Vertaling: TDictionary); + procedure LaadEnSelecteerWaardenCheckComboBox(Waarden: TDictionary; CheckedComboBox: TCheckedComboBox; + GeselecteerdeWaarden: TList; DefaultGeselecteerdeWaarden: TList; Vertaling: TDictionary); + public + Constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; + ProductVerpakkingSubject: TSubject); + end; + +implementation + +{$R *.dfm} + +uses Util, System.StrUtils, CustomPanelVerpakkingParameter; + +Constructor TFormVerpakkingDetail.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; + ProductVerpakkingSubject: TSubject); +begin + inherited Create(AOwner, Navigator, ApplicationContext); + self.FProductVerpakkingSubject := ProductVerpakkingSubject; + self.FProductVerpakkingSubjectObserver := TSubjectObserver.Create(self); + self.FProductVerpakkingSubjectObserver.OnChange := UpdateGui; +end; + +procedure TFormVerpakkingDetail.FormCreate(Sender: TObject); +begin + LaadCheckedComboBoxen(); + + // Registreer bij observer + FProductVerpakkingSubject.RegisterObserver(FProductVerpakkingSubjectObserver); +end; + +procedure TFormVerpakkingDetail.FormDestroy(Sender: TObject); +begin + FProductVerpakkingSubject.UnregisterObserver(FProductVerpakkingSubjectObserver); +end; + +procedure TFormVerpakkingDetail.LaadCheckedComboBoxen(); +begin + // Vervang sommige comboboxen door TCheckedComboBox + CheckComboBoxPositie := TCheckedComboBox.Create(self); + with CheckComboBoxPositie do + CheckComboBoxPositie.Delimiter := ';'; + TUtil.VervangControl(ComboBoxPositie, CheckComboBoxPositie); + + CheckComboBoxRichting := TCheckedComboBox.Create(self); + with CheckComboBoxRichting do + CheckComboBoxRichting.Delimiter := ';'; + TUtil.VervangControl(ComboBoxRichting, CheckComboBoxRichting); +end; + +procedure TFormVerpakkingDetail.UpdateGui(Sender: TObject); +begin + if ApplicationContext.ProductVerpakkingContext.GeselecteerdeVerpakking <> nil then + ToonProductVerpakking(ApplicationContext.ProductVerpakkingContext.GeselecteerdeVerpakking); + + UpdateControlsEnableStatus(); +end; + +procedure TFormVerpakkingDetail.LaadEnSelecteerWaardenComboBox(Waarden: TDictionary; ComboBox: TComboBox; + GeselecteerdeWaarde: string; DefaultGeselecteerdeWaarde: string; Vertaling: TDictionary); +var + Item: string; +begin + ComboBox.Items.Clear(); + // Vullen + for Item in Waarden.keys do + ComboBox.Items.AddObject(Vertaling[Item], TObject(Item)); + // Items selecteren. Als waarde niet aanwezig is, uit default halen. Als dat niet gaat eerste item selecteren. + if (GeselecteerdeWaarde <> '') and (Vertaling.TryGetValue(GeselecteerdeWaarde, Item) = True) then + ComboBox.ItemIndex := ComboBox.Items.IndexOf(Item) + else if (DefaultGeselecteerdeWaarde <> '') and (Vertaling.TryGetValue(DefaultGeselecteerdeWaarde, Item) = True) then + ComboBox.ItemIndex := ComboBox.Items.IndexOf(Item) // Default + else if ComboBox.Items.Count > 0 then + ComboBox.ItemIndex := 0; // Geen waarde, geen default, eerste item selecteren. +end; + +procedure TFormVerpakkingDetail.LaadEnSelecteerWaardenCheckComboBox(Waarden: TDictionary; + CheckedComboBox: TCheckedComboBox; GeselecteerdeWaarden: TList; DefaultGeselecteerdeWaarden: TList; + Vertaling: TDictionary); +var + Item: string; + TempStr: string; +begin + CheckedComboBox.Items.Clear(); + + // CheckComboBox vullen. + for Item in Waarden.keys do + CheckedComboBox.Items.AddObject(Waarden[Item], TObject(Item)); + + // Items selecteren. Als waarde niet aanwezig is, uit default halen. + if GeselecteerdeWaarden.Count > 0 then + begin + for Item in GeselecteerdeWaarden do + if Vertaling.TryGetValue(Item, TempStr) = True then + begin + if CheckedComboBox.Items.IndexOf(TempStr) >= 0 then + CheckedComboBox.Checked[CheckedComboBox.Items.IndexOf(TempStr)] := True; + end; + end + else + // Default waarden + for Item in DefaultGeselecteerdeWaarden do + if Vertaling.TryGetValue(Item, TempStr) = True then + begin + if CheckedComboBox.Items.IndexOf(TempStr) >= 0 then + CheckedComboBox.Checked[CheckedComboBox.Items.IndexOf(TempStr)] := True; + end; +end; + +procedure TFormVerpakkingDetail.ToonProductVerpakking(ProductVerpakking: TProductVerpakking); +var + Item: string; + Parameter: TProductVerpakkingParameter; + NieuweParameterControl: TCustomPanelVerpakkingParameter; +begin + // Linkerhelft + + EditMeta.Text := ProductVerpakking.MetaCaptionDisplay; + EditVolumeVan.Text := ProductVerpakking.VolumeVanCaption; + + // DeelVan + ComboBoxDeelVan.Items.Clear(); + // ComboBox vullen en item selecteren. + for Item in ApplicationContext.ProductVerpakkingContext.GetDeelVanOpties(ProductVerpakking) do + begin + 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.ProductVerpakkingContext.ProductVerpakkingen.IndexOf + (ProductVerpakking.DeelVan) + else + // Default waarde: 'niks' optie selecteren + ComboBoxDeelVan.ItemIndex := ComboBoxDeelVan.Items.Count - 1; + + // Breedte, Diepte, Hoogte. + // Default waarde altijd als placeholder instellen + EditBreedte.TextHint := ProductVerpakking.DefaultBreedte; // Default + if ProductVerpakking.Breedte <> '' then + EditBreedte.Text := ProductVerpakking.Breedte; + + EditDiepte.TextHint := ProductVerpakking.DefaultDiepte; // Default + if ProductVerpakking.Diepte <> '' then + EditDiepte.Text := ProductVerpakking.Diepte; + + EditHoogte.TextHint := ProductVerpakking.DefaultHoogte; // Default + if ProductVerpakking.Hoogte <> '' then + EditHoogte.Text := ProductVerpakking.Hoogte; + + // Max.Comb.Aantal, Aantal + EditMaxCombAantal.Text := ProductVerpakking.MaxCombinAantal; + EditAantal.Text := ProductVerpakking.Aantal; + + // Parameters + TUtil.FreeControlChildren(ScrollBoxParameters); + for Parameter in ProductVerpakking.Parameters do + begin + NieuweParameterControl := TCustomPanelVerpakkingParameter.Create(ScrollBoxParameters); + with NieuweParameterControl do + begin + Parent := ScrollBoxParameters; + ProductVerpakkingParameter := Parameter; + end; + end; + + // Rechterhelft + + // Plaatsing + LaadEnSelecteerWaardenComboBox(ApplicationContext.UiInstellingenContext.Plaatsing, ComboBoxPlaatsing, + ProductVerpakking.Plaatsing, ProductVerpakking.DefaultPlaatsing, ApplicationContext.UiInstellingenContext.Plaatsing); + + // Positie + LaadEnSelecteerWaardenCheckComboBox(ApplicationContext.UiInstellingenContext.Posities, CheckComboBoxPositie, + ProductVerpakking.Posities, ProductVerpakking.DefaultPosities, ApplicationContext.UiInstellingenContext.Posities); + + // Richting + LaadEnSelecteerWaardenCheckComboBox(ApplicationContext.UiInstellingenContext.Richtingen, CheckComboBoxRichting, + ProductVerpakking.Richtingen, ProductVerpakking.DefaultRichtingen, ApplicationContext.UiInstellingenContext.Richtingen); + + // OptiType + LaadEnSelecteerWaardenComboBox(ApplicationContext.UiInstellingenContext.OptiTypes, ComboBoxOptiType, ProductVerpakking.OptiType, + ProductVerpakking.DefaultOptiType, ApplicationContext.UiInstellingenContext.OptiTypes); +end; + +procedure TFormVerpakkingDetail.UpdateControlsEnableStatus(); +var + VerpakkingAanwezigEnGeselecteerd: Boolean; + I: Integer; +begin + // Details controls enable status aanpassen naargelang er een verpakking geselecteerd is. + VerpakkingAanwezigEnGeselecteerd := ApplicationContext.ProductVerpakkingContext.GeselecteerdeVerpakking <> nil; + for I := 0 to PanelVerpakkingControls.ControlCount - 1 do + if Assigned(PanelVerpakkingControls.Controls[I]) then + PanelVerpakkingControls.Controls[I].Enabled := VerpakkingAanwezigEnGeselecteerd; + + // Linkerdeel, wat hierboven ook uitkomt, deze controls overschrijven. + EditMeta.Enabled := False; + EditVolumeVan.Enabled := False; + ComboBoxDeelVan.Enabled := (ComboBoxDeelVan.Items.Count > 0) and VerpakkingAanwezigEnGeselecteerd; +end; + +end. Index: VerpakkingsDefinitie/UI/VerpakkingDetailScherm.dfm =================================================================== diff -u --- VerpakkingsDefinitie/UI/VerpakkingDetailScherm.dfm (revision 0) +++ VerpakkingsDefinitie/UI/VerpakkingDetailScherm.dfm (revision 594) @@ -0,0 +1,227 @@ +object FormVerpakkingDetail: TFormVerpakkingDetail + Left = 0 + Top = 0 + Caption = 'FormVerpakkingDetail' + ClientHeight = 418 + ClientWidth = 658 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnDestroy = FormDestroy + DesignSize = ( + 658 + 418) + PixelsPerInch = 96 + TextHeight = 13 + object PanelVerpakkingControls: TPanel + Left = 0 + Top = 0 + Width = 657 + Height = 417 + Anchors = [akLeft, akTop, akRight, akBottom] + BevelOuter = bvNone + TabOrder = 0 + object Label10: TLabel + Left = 8 + Top = 271 + Width = 55 + Height = 13 + Caption = 'Parameters' + end + object Label11: TLabel + Left = 360 + Top = 79 + Width = 43 + Height = 13 + Caption = 'Plaatsing' + end + object Label12: TLabel + Left = 360 + Top = 111 + Width = 31 + Height = 13 + Caption = 'Positie' + end + object Label13: TLabel + Left = 360 + Top = 143 + Width = 38 + Height = 13 + Caption = 'Richting' + end + object Label2: TLabel + Left = 8 + Top = 15 + Width = 24 + Height = 13 + Caption = 'Meta' + end + object Label4: TLabel + Left = 8 + Top = 79 + Width = 42 + Height = 13 + Caption = 'Deel van' + end + object Label5: TLabel + Left = 8 + Top = 111 + Width = 38 + Height = 13 + Caption = 'Breedte' + end + object Label6: TLabel + Left = 8 + Top = 143 + Width = 31 + Height = 13 + Caption = 'Diepte' + end + object Label7: TLabel + Left = 8 + Top = 175 + Width = 35 + Height = 13 + Caption = 'Hoogte' + end + object Label8: TLabel + Left = 8 + Top = 207 + Width = 85 + Height = 13 + Caption = 'Max comb. aantal' + end + object Label9: TLabel + Left = 8 + Top = 239 + Width = 31 + Height = 13 + Caption = 'Aantal' + end + object Label3: TLabel + Left = 8 + Top = 47 + Width = 55 + Height = 13 + Caption = 'Volume van' + end + object Label14: TLabel + Left = 360 + Top = 207 + Width = 44 + Height = 13 + Caption = 'OptiType' + end + object ButtonMeta: TButton + Left = 272 + Top = 12 + Width = 40 + Height = 21 + Caption = '...' + TabOrder = 0 + end + object ComboBoxDeelVan: TComboBox + Left = 112 + Top = 76 + Width = 200 + Height = 21 + Style = csDropDownList + TabOrder = 1 + end + object ComboBoxPlaatsing: TComboBox + Left = 464 + Top = 76 + Width = 162 + Height = 21 + Style = csDropDownList + TabOrder = 2 + end + object ComboBoxPositie: TComboBox + Left = 464 + Top = 108 + Width = 162 + Height = 21 + Style = csDropDownList + TabOrder = 3 + end + object ComboBoxRichting: TComboBox + Left = 464 + Top = 140 + Width = 162 + Height = 21 + Style = csDropDownList + TabOrder = 4 + end + object EditAantal: TEdit + Left = 112 + Top = 236 + Width = 200 + Height = 21 + TabOrder = 5 + end + object EditBreedte: TEdit + Left = 112 + Top = 108 + Width = 200 + Height = 21 + TabOrder = 6 + end + object EditDiepte: TEdit + Left = 112 + Top = 140 + Width = 200 + Height = 21 + TabOrder = 7 + end + object EditHoogte: TEdit + Left = 112 + Top = 172 + Width = 200 + Height = 21 + TabOrder = 8 + end + object EditMaxCombAantal: TEdit + Left = 112 + Top = 204 + Width = 200 + Height = 21 + TabOrder = 9 + end + object EditMeta: TEdit + Left = 112 + Top = 12 + Width = 154 + Height = 21 + Enabled = False + TabOrder = 10 + end + object EditVolumeVan: TEdit + Left = 112 + Top = 44 + Width = 154 + Height = 21 + Enabled = False + TabOrder = 11 + end + object ComboBoxOptiType: TComboBox + Left = 464 + Top = 204 + Width = 162 + Height = 21 + Style = csDropDownList + TabOrder = 12 + end + object ScrollBoxParameters: TScrollBox + Left = 112 + Top = 268 + Width = 200 + Height = 125 + TabOrder = 13 + end + end +end Index: VerpakkingsDefinitie/UI/ProductDetailScherm.pas =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 593) +++ VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 594) @@ -4,14 +4,14 @@ uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Generics.Collections, Vcl.ExtCtrls, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Generics.Collections, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.CheckLst, Subscherm, Navigator, - ApplicationContext, - ObserverPattern, Vcl.ComCtrls, Vcl.CheckLst, + ApplicationContext, ProductsAgent, + ObserverPattern, CheckCombo; resourceString - GEEN_DATA_CAPTION = 'Geen data om te tonen'; + GEEN_DATA_CAPTION = 'Geen product geselecteerd'; NERGENS_DEEL_VAN_CAPTION = '--Nergens deel van--'; type @@ -24,59 +24,25 @@ GroupBox1: TGroupBox; ButtonNieuw: TButton; ButtonVerwijder: TButton; - Label2: TLabel; - Label4: TLabel; - Label5: TLabel; - Label6: TLabel; - Label7: TLabel; - Label8: TLabel; - Label9: TLabel; - Label10: TLabel; - Label11: TLabel; - Label12: TLabel; - Label13: TLabel; - EditMeta: TEdit; - ComboBoxDeelVan: TComboBox; - EditBreedte: TEdit; - EditDiepte: TEdit; - EditHoogte: TEdit; - EditMaxCombAantal: TEdit; - EditAantal: TEdit; - ComboBoxPlaatsing: TComboBox; - ComboBoxPositie: TComboBox; - ComboBoxRichting: TComboBox; - ButtonMeta: TButton; - PanelVerpakkingControls: TPanel; - Label3: TLabel; - EditVolumeVan: TEdit; - Label14: TLabel; - ComboBoxOptiType: TComboBox; LabelProductNummer: TLabel; Label17: TLabel; - ScrollBoxParameters: TScrollBox; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure ListViewVerpakkingenSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); private FProductDetailsSubject: TSubject; FProductDetailsSubjectObserver: TSubjectObserver; + FProductsAgent: TProductsAgent; LabelGeenData: TLabel; - CheckComboBoxPositie: TCheckedComboBox; - CheckComboBoxRichting: TCheckedComboBox; procedure UpdateGui(Sender: TObject); - procedure ToonProductVerpakking(ProductVerpakking: TProductVerpakking); procedure UpdateControlsEnableStatus(); procedure UpdateGuiDataAanwezigheid(Aanwezig: Boolean); - procedure LaadEnSelecteerWaardenComboBox(Waarden: TDictionary; ComboBox: TComboBox; - GeselecteerdeWaarde: string; DefaultGeselecteerdeWaarde: string; Vertaling: TDictionary); - procedure LaadEnSelecteerWaardenCheckComboBox(Waarden: TDictionary; CheckedComboBox: TCheckedComboBox; - GeselecteerdeWaarden: TList; DefaultGeselecteerdeWaarden: TList; Vertaling: TDictionary); public Constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; - ProductDetailsSubject: TSubject); + ProductDetailsSubject: TSubject; ProductsAgent: TProductsAgent); end; implementation @@ -85,27 +51,17 @@ {$R *.dfm} Constructor TFormProductDetail.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; - ProductDetailsSubject: TSubject); + ProductDetailsSubject: TSubject; ProductsAgent: TProductsAgent); begin inherited Create(AOwner, Navigator, ApplicationContext); self.FProductDetailsSubject := ProductDetailsSubject; self.FProductDetailsSubjectObserver := TSubjectObserver.Create(self); self.FProductDetailsSubjectObserver.OnChange := UpdateGui; + self.FProductsAgent := ProductsAgent; end; procedure TFormProductDetail.FormCreate(Sender: TObject); begin - // Vervang sommige comboboxen door TCheckedComboBox - CheckComboBoxPositie := TCheckedComboBox.Create(self); - with CheckComboBoxPositie do - CheckComboBoxPositie.Delimiter := ';'; - TUtil.VervangControl(ComboBoxPositie, CheckComboBoxPositie); - - CheckComboBoxRichting := TCheckedComboBox.Create(self); - with CheckComboBoxRichting do - CheckComboBoxRichting.Delimiter := ';'; - TUtil.VervangControl(ComboBoxRichting, CheckComboBoxRichting); - // Registreer bij observer FProductDetailsSubject.RegisterObserver(FProductDetailsSubjectObserver); end; @@ -118,17 +74,44 @@ procedure TFormProductDetail.ListViewVerpakkingenSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); begin if Selected then - if (ListViewVerpakkingen.Selected.Data <> nil) then - ToonProductVerpakking(TProductVerpakking(ListViewVerpakkingen.Selected.Data)); + begin + ApplicationContext.ProductVerpakkingContext.GeselecteerdeVerpakking := TProductVerpakking(ListViewVerpakkingen.Selected.Data); + ApplicationContext.ProductVerpakkingContext.NotifyChanged(); { TODO : Vervangen door notify changed in setter } + end; end; procedure TFormProductDetail.UpdateGui(Sender: TObject); var GeselecteerdProduct: TProductInformatie; + ErrorMessage: string; ProductVerpakking: TProductVerpakking; VorigeIndexInList: Integer; begin GeselecteerdProduct := ApplicationContext.ProductsContext.GeselecteerdProduct; + + if GeselecteerdProduct <> nil then + begin + // Product informatie ophalen + FProductsAgent.ZoekProductVerpakkingenMetProductNr(GeselecteerdProduct.ProductNr, self.ApplicationContext.UserContext, + self.ApplicationContext.ProductVerpakkingContext); + + if self.ApplicationContext.ProductVerpakkingContext.IsOK then + // Gelukt + Navigator.NavigeerNaar(NAVTOONPRODUCTVERPAKKING) + else + begin + // Opzoeking gefaald + ErrorMessage := self.ApplicationContext.ProductVerpakkingContext.ErrorMessage; + if self.ApplicationContext.ProductVerpakkingContext.InternalErrorMessage <> '' then + begin + ErrorMessage := ErrorMessage + sLineBreak + self.ApplicationContext.ProductVerpakkingContext.InternalErrorMessage; + end; + + MessageDlg(ErrorMessage, TMsgDlgType.mtInformation, [mbOK], 0, mbCancel); + exit; + end; + end; + if (GeselecteerdProduct = nil) or (ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count = 0) then begin UpdateGuiDataAanwezigheid(False); @@ -137,6 +120,8 @@ else UpdateGuiDataAanwezigheid(True); + UpdateControlsEnableStatus(); + // Update met data uit ApplicationContext LabelOmschrijving1.Caption := GeselecteerdProduct.Omschrijving1; LabelOmschrijving2.Caption := GeselecteerdProduct.Omschrijving2; @@ -172,162 +157,21 @@ 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 + ProductVerpakking := ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen[0] else ProductVerpakking := nil; // Geen verpakking aanwezig - if ProductVerpakking <> nil then - ToonProductVerpakking(ProductVerpakking); - - UpdateControlsEnableStatus() + ApplicationContext.ProductVerpakkingContext.GeselecteerdeVerpakking := ProductVerpakking; end; -procedure TFormProductDetail.ToonProductVerpakking(ProductVerpakking: TProductVerpakking); -var - Item: string; - Parameter: TProductVerpakkingParameter; - NieuweParameterControl: TCustomPanelVerpakkingParameter; -begin - // Linkerhelft - - EditMeta.Text := ProductVerpakking.MetaCaptionDisplay; - EditVolumeVan.Text := ProductVerpakking.VolumeVanCaption; - - // DeelVan - ComboBoxDeelVan.Items.Clear(); - // ComboBox vullen en item selecteren. - for Item in ApplicationContext.ProductVerpakkingContext.GetDeelVanOpties(ProductVerpakking) do - begin - 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.ProductVerpakkingContext.ProductVerpakkingen.IndexOf - (ProductVerpakking.DeelVan) - else - // Default waarde: 'niks' optie selecteren - ComboBoxDeelVan.ItemIndex := ComboBoxDeelVan.Items.Count - 1; - - // Breedte, Diepte, Hoogte. - // Default waarde altijd als placeholder instellen - EditBreedte.TextHint := ProductVerpakking.DefaultBreedte; // Default - if ProductVerpakking.Breedte <> '' then - EditBreedte.Text := ProductVerpakking.Breedte; - - EditDiepte.TextHint := ProductVerpakking.DefaultDiepte; // Default - if ProductVerpakking.Diepte <> '' then - EditDiepte.Text := ProductVerpakking.Diepte; - - EditHoogte.TextHint := ProductVerpakking.DefaultHoogte; // Default - if ProductVerpakking.Hoogte <> '' then - EditHoogte.Text := ProductVerpakking.Hoogte; - - // Max.Comb.Aantal, Aantal - EditMaxCombAantal.Text := ProductVerpakking.MaxCombinAantal; - EditAantal.Text := ProductVerpakking.Aantal; - - // Parameters - TUtil.FreeControlChildren(ScrollBoxParameters); - for Parameter in ProductVerpakking.Parameters do - begin - NieuweParameterControl := TCustomPanelVerpakkingParameter.Create(ScrollBoxParameters); - with NieuweParameterControl do - begin - Parent := ScrollBoxParameters; - ProductVerpakkingParameter := Parameter; - end; - end; - - // Rechterhelft - - // Plaatsing - LaadEnSelecteerWaardenComboBox(ApplicationContext.UiInstellingenContext.Plaatsing, ComboBoxPlaatsing, - ProductVerpakking.Plaatsing, ProductVerpakking.DefaultPlaatsing, ApplicationContext.UiInstellingenContext.Plaatsing); - - // Positie - LaadEnSelecteerWaardenCheckComboBox(ApplicationContext.UiInstellingenContext.Posities, CheckComboBoxPositie, - ProductVerpakking.Posities, ProductVerpakking.DefaultPosities, ApplicationContext.UiInstellingenContext.Posities); - - // Richting - LaadEnSelecteerWaardenCheckComboBox(ApplicationContext.UiInstellingenContext.Richtingen, CheckComboBoxRichting, - ProductVerpakking.Richtingen, ProductVerpakking.DefaultRichtingen, ApplicationContext.UiInstellingenContext.Richtingen); - - // OptiType - LaadEnSelecteerWaardenComboBox(ApplicationContext.UiInstellingenContext.OptiTypes, ComboBoxOptiType, ProductVerpakking.OptiType, - ProductVerpakking.DefaultOptiType, ApplicationContext.UiInstellingenContext.OptiTypes); -end; - -procedure TFormProductDetail.LaadEnSelecteerWaardenComboBox(Waarden: TDictionary; ComboBox: TComboBox; - GeselecteerdeWaarde: string; DefaultGeselecteerdeWaarde: string; Vertaling: TDictionary); -var - Item: string; -begin - ComboBox.Items.Clear(); - // Vullen - for Item in Waarden.keys do - ComboBox.Items.AddObject(Vertaling[Item], TObject(Item)); - // Items selecteren. Als waarde niet aanwezig is, uit default halen. Als dat niet gaat eerste item selecteren. - if (GeselecteerdeWaarde <> '') and (Vertaling.TryGetValue(GeselecteerdeWaarde, Item) = True) then - ComboBox.ItemIndex := ComboBox.Items.IndexOf(Item) - else if (DefaultGeselecteerdeWaarde <> '') and (Vertaling.TryGetValue(DefaultGeselecteerdeWaarde, Item) = True) then - ComboBox.ItemIndex := ComboBox.Items.IndexOf(Item) // Default - else if ComboBox.Items.Count > 0 then - ComboBox.ItemIndex := 0; // Geen waarde, geen default, eerste item selecteren. -end; - -procedure TFormProductDetail.LaadEnSelecteerWaardenCheckComboBox(Waarden: TDictionary; - CheckedComboBox: TCheckedComboBox; GeselecteerdeWaarden: TList; DefaultGeselecteerdeWaarden: TList; - Vertaling: TDictionary); -var - Item: string; - TempStr: string; -begin - CheckedComboBox.Items.Clear(); - - // CheckComboBox vullen. - for Item in Waarden.keys do - CheckedComboBox.Items.AddObject(Waarden[Item], TObject(Item)); - - // Items selecteren. Als waarde niet aanwezig is, uit default halen. - if GeselecteerdeWaarden.Count > 0 then - begin - for Item in GeselecteerdeWaarden do - if Vertaling.TryGetValue(Item, TempStr) = True then - begin - if CheckedComboBox.Items.IndexOf(TempStr) >= 0 then - CheckedComboBox.Checked[CheckedComboBox.Items.IndexOf(TempStr)] := True; - end; - end - else - // Default waarden - for Item in DefaultGeselecteerdeWaarden do - if Vertaling.TryGetValue(Item, TempStr) = True then - begin - if CheckedComboBox.Items.IndexOf(TempStr) >= 0 then - CheckedComboBox.Checked[CheckedComboBox.Items.IndexOf(TempStr)] := True; - end; -end; - procedure TFormProductDetail.UpdateControlsEnableStatus(); var VerpakkingAanwezigEnGeselecteerd: Boolean; - I: Integer; begin // Details controls enable status aanpassen naargelang er een verpakking geselecteerd is. - VerpakkingAanwezigEnGeselecteerd := (ListViewVerpakkingen.Items.Count = 0) or (ListViewVerpakkingen.ItemIndex < 0); - for I := 0 to PanelVerpakkingControls.ControlCount - 1 do - if Assigned(PanelVerpakkingControls.Controls[I]) then - PanelVerpakkingControls.Controls[I].Enabled := VerpakkingAanwezigEnGeselecteerd; - + VerpakkingAanwezigEnGeselecteerd := (ListViewVerpakkingen.Items.Count > 0) and (ListViewVerpakkingen.ItemIndex >= 0); ButtonVerwijder.Enabled := VerpakkingAanwezigEnGeselecteerd; - - // Linkerdeel - EditMeta.Enabled := False; - EditVolumeVan.Enabled := False; - ComboBoxDeelVan.Enabled := (ComboBoxDeelVan.Items.Count > 0) and VerpakkingAanwezigEnGeselecteerd; end; procedure TFormProductDetail.UpdateGuiDataAanwezigheid(Aanwezig: Boolean); @@ -346,7 +190,6 @@ self.Controls[I].Visible := True; LabelGeenData.Visible := False; - PanelVerpakkingControls.Refresh(); // Anders verdwijnt label enkel op resize FreeAndNil(LabelGeenData); end else Index: VerpakkingsDefinitie/UI/NavProductScherm.dfm =================================================================== diff -u -r593 -r594 --- VerpakkingsDefinitie/UI/NavProductScherm.dfm (.../NavProductScherm.dfm) (revision 593) +++ VerpakkingsDefinitie/UI/NavProductScherm.dfm (.../NavProductScherm.dfm) (revision 594) @@ -4,7 +4,7 @@ BorderStyle = bsSingle Caption = 'FormProductNav' ClientHeight = 564 - ClientWidth = 888 + ClientWidth = 1004 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -52,13 +52,11 @@ end> ShowCaption = False TabOrder = 0 - ExplicitLeft = -1 - ExplicitTop = -8 end object GridPanelRight: TGridPanel Left = 369 Top = 0 - Width = 519 + Width = 635 Height = 564 Align = alClient Anchors = [] @@ -81,6 +79,6 @@ end> ShowCaption = False TabOrder = 1 - ExplicitWidth = 352 + ExplicitWidth = 519 end end