Index: VerpakkingsDefinitie/UI/LogInScherm.pas
===================================================================
diff -u -r571 -r593
--- VerpakkingsDefinitie/UI/LogInScherm.pas (.../LogInScherm.pas) (revision 571)
+++ VerpakkingsDefinitie/UI/LogInScherm.pas (.../LogInScherm.pas) (revision 593)
@@ -6,7 +6,7 @@
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
- Main, ApplicationContext, Subscherm,
+ Navigator, ApplicationContext, Subscherm,
UserAgent;
type
@@ -27,7 +27,7 @@
FUserAgent: TUserAgent;
procedure Login();
public
- Constructor Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext; UserAgent: TUserAgent);
+ Constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; UserAgent: TUserAgent);
end;
implementation
@@ -37,7 +37,7 @@
{$R *.dfm}
-constructor TFormLogin.Create(AOwner: TComponent; Navigator: TFormMain; ApplicationContext: TApplicationContext;
+constructor TFormLogin.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext;
UserAgent: TUserAgent);
begin
inherited Create(AOwner, Navigator, ApplicationContext);
@@ -99,7 +99,7 @@
if ApplicationContext.UserContext.IsOK then
begin
- self.Navigator.NavigeerNaar(Main.NAVZOEKPRODUCTEN);
+ self.Navigator.NavigeerNaar(NAVHOME);
end
else
begin
Index: VerpakkingsDefinitie/Main.pas
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/Main.pas (.../Main.pas) (revision 592)
+++ VerpakkingsDefinitie/Main.pas (.../Main.pas) (revision 593)
@@ -6,23 +6,14 @@
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
- ApplicationContext, UserAgent, ProductsAgent;
+ ApplicationContext, UserAgent, ProductsAgent, Navigator;
-const
- NAVHOME = 0;
- NAVLOGIN = 1;
- NAVZOEKPRODUCTEN = 2;
-
type
- INavigator = interface
- ['{1648577B-6F43-4C3D-9122-F4F74D998611}']
- procedure NavigeerNaar(schermId: Integer);
- end;
-
TControlArray = Array of TControl;
TFormMain = class(TForm, INavigator)
PanelMain: TPanel;
+ PanelGebruiker: TPanel;
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
@@ -43,7 +34,7 @@
implementation
uses
- Util, LogInScherm, NavProductScherm;
+ Util, LogInScherm, NavProductScherm, GebruikerScherm;
{$R *.dfm}
@@ -58,9 +49,14 @@
FAppContext := TApplicationContext.Create();
FUserAgent := TUserAgent.Create();
FProductsAgent := TProductsAgent.Create();
- PanelMain.Parent := Self;
- PanelMain.Align := TAlign.alClient;
+ with TFormGebruiker.Create(PanelGebruiker, Self, FAppContext, FAppContext.UserContext, FUserAgent) do
+ begin
+ Parent := PanelGebruiker;
+ Align := alClient;
+ Show;
+ end;
+
Self.NavigeerNaar(NAVLOGIN);
end;
@@ -73,13 +69,19 @@
// Volgende subscherm laden in panel
// PanelMain behouden we altijd, the children can be free.
- TUtil.FreeControlChildrenDeep(PanelMain);
+ TUtil.FreeControlChildren(PanelMain);
case schermId of
- NAVHOME, NAVZOEKPRODUCTEN:
- NieuwScherm := TFormProductNav.Create(PanelMain, Self, FAppContext, FUserAgent, FProductsAgent);
+ NAVHOME, NAVPRODUCTEN:
+ begin
+ NieuwScherm := TFormProductNav.Create(PanelMain, Self, FAppContext, FUserAgent, FProductsAgent);
+ PanelGebruiker.Visible := true;
+ end;
NAVLOGIN:
- NieuwScherm := TFormLogin.Create(PanelMain, Self, FAppContext, FUserAgent);
+ begin
+ NieuwScherm := TFormLogin.Create(PanelMain, Self, FAppContext, FUserAgent);
+ PanelGebruiker.Visible := false;
+ end;
else
Exception.Create('SchermID: ' + IntToStr(schermId) + ' is onbekend');
NavigeerNaar(NAVHOME);
Index: VerpakkingsDefinitie/UI/NavProductScherm.pas
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/UI/NavProductScherm.pas (.../NavProductScherm.pas) (revision 592)
+++ VerpakkingsDefinitie/UI/NavProductScherm.pas (.../NavProductScherm.pas) (revision 593)
@@ -5,17 +5,20 @@
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls,
- Subscherm, Main, ApplicationContext, ProductsAgent, UserAgent;
+ Subscherm, Navigator, ApplicationContext, ProductsAgent, UserAgent;
type
TFormProductNav = class(TFormSubscherm, INavigator)
- PanelMain: TPanel;
+ GridPanelLeft: TGridPanel;
+ Splitter1: TSplitter;
+ GridPanelRight: TGridPanel;
+ procedure FormCreate(Sender: TObject);
private
FUserAgent: TUserAgent;
FProductsAgent: TProductsAgent;
public
- constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext;
- UserAgent: TUserAgent; ProductsAgent: TProductsAgent);
+ constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; UserAgent: TUserAgent;
+ ProductsAgent: TProductsAgent);
procedure NavigeerNaar(schermId: Integer);
end;
@@ -24,41 +27,62 @@
{$R *.dfm}
uses
- NavGridPanel, Util,
+ Util,
ZoekProductenScherm, GebruikerScherm, GevondenProductenScherm, ProductDetailScherm;
constructor TFormProductNav.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext;
UserAgent: TUserAgent; ProductsAgent: TProductsAgent);
-var
- NavGridPanelStandard: TNavGridPanelStandard;
begin
inherited Create(AOwner, Navigator, ApplicationContext);
self.FUserAgent := UserAgent;
self.FProductsAgent := ProductsAgent;
- { TODO -cUI : Onderzoeken of 'TSplitter' een beter alternatief is dan volledig een gridview }
+end;
- // Gebruikersgegevens scherm, zoekscherm, resultaten en detail scherm inladen.
- NavGridPanelStandard := TNavGridPanelStandard.Create(PanelMain);
+procedure TFormProductNav.FormCreate(Sender: TObject);
+begin
FProductsAgent.LaadUIInstellingen(ApplicationContext.UserContext, ApplicationContext.UiInstellingenContext);
- // Gebruikersgegevens scherm bovenaan
- // Zoekscherm daaronder links
- // Resultaten scherm daaronder links
- // Rechts is helemaal voor detail scherm
- NavGridPanelStandard.Init(TFormGebruiker.Create(NavGridPanelStandard, self, ApplicationContext, ApplicationContext.UserContext,
- FUserAgent), TFormZoekProducten.Create(NavGridPanelStandard, self, ApplicationContext, FProductsAgent),
- TFormGevondenProducten.Create(NavGridPanelStandard, self, ApplicationContext, ApplicationContext.ProductsContext,
- FProductsAgent), TFormProductDetail.Create(NavGridPanelStandard, self, ApplicationContext,
- ApplicationContext.ProductVerpakkingContext));
-
- NavGridPanelStandard.Parent := PanelMain;
- NavGridPanelStandard.Align := alClient;
- NavGridPanelStandard.Show;
+ NavigeerNaar(NAVZOEKPRODUCTEN);
end;
procedure TFormProductNav.NavigeerNaar(schermId: Integer);
begin
+ case schermId of
+ NAVHOME:
+ Navigator.NavigeerNaar(NAVHOME); // Geef aan parent navigator
+ NAVZOEKPRODUCTEN:
+ begin
+ ApplicationContext.ProductsContext.Reset();
+ // Maak beide grids leeg
+ TUtil.FreeControlChildren(GridPanelLeft);
+ TUtil.FreeControlChildren(GridPanelRight);
+ // Vul linkergrid
+ TUtil.PlaatsControlOpGrid(GridPanelLeft, TFormZoekProducten.Create(GridPanelLeft, self, ApplicationContext,
+ FProductsAgent), 0, 0);
+ TUtil.PlaatsControlOpGrid(GridPanelLeft, TFormGevondenProducten.Create(GridPanelLeft, self, ApplicationContext,
+ ApplicationContext.ProductsContext, FProductsAgent), 1, 0);
+ end;
+ NAVTOONPRODUCTEN:
+ begin
+ end;
+ NAVTOONPRODUCT:
+ begin
+ // Geen nieuw grid plaatsen wanneer er al een aanwezig is
+ if GridPanelRight.ControlCount = 0 then
+ // Vul rechtergrid
+ TUtil.PlaatsControlOpGrid(GridPanelRight, TFormProductDetail.Create(GridPanelRight, self, ApplicationContext,
+ ApplicationContext.ProductVerpakkingContext), 0, 0, 2);
+
+ end;
+ NAVTOONPRODUCTVERPAKKING:
+ begin
+ end;
+ else
+ Exception.Create('SchermID: ' + IntToStr(schermId) + ' is onbekend');
+ NavigeerNaar(NAVHOME);
+ exit;
+ end;
end;
end.
Index: VerpakkingsDefinitie/UI/Navigator.pas
===================================================================
diff -u
--- VerpakkingsDefinitie/UI/Navigator.pas (revision 0)
+++ VerpakkingsDefinitie/UI/Navigator.pas (revision 593)
@@ -0,0 +1,22 @@
+unit Navigator;
+
+interface
+
+const
+ NAVHOME = 0;
+ NAVLOGIN = 1;
+ NAVPRODUCTEN = 2;
+ NAVZOEKPRODUCTEN = 3;
+ NAVTOONPRODUCTEN = 4;
+ NAVTOONPRODUCT = 5;
+ NAVTOONPRODUCTVERPAKKING = 6;
+
+type
+ INavigator = interface
+ ['{1648577B-6F43-4C3D-9122-F4F74D998611}']
+ procedure NavigeerNaar(schermId: Integer);
+ end;
+
+implementation
+
+end.
Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dproj
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 592)
+++ VerpakkingsDefinitie/VerpakkingsDefinitie.dproj (.../VerpakkingsDefinitie.dproj) (revision 593)
@@ -108,7 +108,6 @@
-
dfm
@@ -125,6 +124,7 @@
dfm
+
Cfg_2
Base
FishEye: Tag 593 refers to a dead (removed) revision in file `VerpakkingsDefinitie/UI/NavGridPanel.pas'.
FishEye: No comparison available. Pass `N' to diff?
Index: VerpakkingsDefinitie/UI/ZoekProductenScherm.pas
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/UI/ZoekProductenScherm.pas (.../ZoekProductenScherm.pas) (revision 592)
+++ VerpakkingsDefinitie/UI/ZoekProductenScherm.pas (.../ZoekProductenScherm.pas) (revision 593)
@@ -7,7 +7,7 @@
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.ComCtrls, Vcl.StdCtrls,
- Subscherm, Main,
+ Subscherm, Navigator,
ApplicationContext, ProductsAgent;
type
@@ -74,9 +74,6 @@
procedure TFormZoekProducten.FormCreate(Sender: TObject);
begin
- // Vorige opzoeking is ongeldig
- self.ApplicationContext.ProductsContext.reset();
-
// UI configuratie
// Zoeken op kort tekst
ComboBoxBeperkKortTekst.ItemIndex := 0; // Default value
@@ -148,8 +145,8 @@
else
raise Exception.Create('Ongeldige waarde geselecteerd');
- FProductsAgent.ZoekOp(ApplicationContext.UserContext, ApplicationContext.ProductsContext, TZoekMethode.KortTekst,
- EditZoekKortTekst.text, KlantNummer, LeveranciersNummer, '', '');
+ FProductsAgent.ZoekOp(ApplicationContext.UserContext, ApplicationContext.ProductsContext, TZoekMethode.KortTekst,
+ EditZoekKortTekst.text, KlantNummer, LeveranciersNummer, '', '');
VerwerkOpzoeking();
end;
@@ -210,7 +207,10 @@
var
ErrorMessage: string;
begin
- if ApplicationContext.ProductsContext.IsOK = false then
+ if ApplicationContext.ProductsContext.IsOK then
+ // Gelukt
+ Navigator.NavigeerNaar(NAVTOONPRODUCTEN)
+ else
begin
// Opzoeking gefaald
ErrorMessage := ApplicationContext.ProductsContext.ErrorMessage;
Index: VerpakkingsDefinitie/Main.dfm
===================================================================
diff -u -r581 -r593
--- VerpakkingsDefinitie/Main.dfm (.../Main.dfm) (revision 581)
+++ VerpakkingsDefinitie/Main.dfm (.../Main.dfm) (revision 593)
@@ -13,21 +13,41 @@
OldCreateOrder = False
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
- DesignSize = (
- 1184
- 711)
PixelsPerInch = 96
TextHeight = 13
object PanelMain: TPanel
+ AlignWithMargins = True
Left = 0
- Top = 0
+ Top = 40
Width = 1184
- Height = 711
- Anchors = [akLeft, akTop, akRight, akBottom]
+ Height = 671
+ Margins.Left = 0
+ Margins.Top = 0
+ Margins.Right = 0
+ Margins.Bottom = 0
+ Align = alClient
+ BevelOuter = bvNone
Color = clWhite
ParentBackground = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
+ ExplicitHeight = 705
end
+ object PanelGebruiker: TPanel
+ AlignWithMargins = True
+ Left = 0
+ Top = 0
+ Width = 1184
+ Height = 40
+ Margins.Left = 0
+ Margins.Top = 0
+ Margins.Right = 0
+ Margins.Bottom = 0
+ Align = alTop
+ BevelOuter = bvNone
+ Color = clRed
+ ParentBackground = False
+ TabOrder = 1
+ end
end
Index: VerpakkingsDefinitie/UI/GevondenProductenScherm.pas
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/UI/GevondenProductenScherm.pas (.../GevondenProductenScherm.pas) (revision 592)
+++ VerpakkingsDefinitie/UI/GevondenProductenScherm.pas (.../GevondenProductenScherm.pas) (revision 593)
@@ -9,7 +9,7 @@
Data.DB, Data.Win.ADODB,
ObserverPattern, Util,
Subscherm,
- ProductsAgent, Main, ApplicationContext;
+ ProductsAgent, Main, Navigator, ApplicationContext;
type
TFormGevondenProducten = class(TFormSubscherm)
@@ -64,7 +64,10 @@
FProductsAgent.ZoekProductDataMetProductNr(TProductInformatie(Item.Data).ProductNr, self.ApplicationContext.UserContext,
self.ApplicationContext.ProductVerpakkingContext);
- if self.ApplicationContext.ProductVerpakkingContext.IsOK = false then
+ if self.ApplicationContext.ProductVerpakkingContext.IsOK then
+ // Gelukt
+ Navigator.NavigeerNaar(NAVTOONPRODUCT)
+ else
begin
// Opzoeking gefaald
ErrorMessage := self.ApplicationContext.ProductVerpakkingContext.ErrorMessage;
Index: VerpakkingsDefinitie/VerpakkingsDefinitie.dpr
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 592)
+++ VerpakkingsDefinitie/VerpakkingsDefinitie.dpr (.../VerpakkingsDefinitie.dpr) (revision 593)
@@ -14,14 +14,14 @@
ObserverPattern in 'UI\ObserverPattern.pas',
SelectService in 'WS\SelectService.pas',
ProductsAgent in 'WS\ProductsAgent.pas',
- NavGridPanel in 'UI\NavGridPanel.pas',
GevondenProductenScherm in 'UI\GevondenProductenScherm.pas' {FormGevondenProducten},
OptiServerService in 'WS\OptiServerService.pas',
ProductDetailScherm in 'UI\ProductDetailScherm.pas' {FormProductDetail},
CheckCombo in 'UI\CheckCombo.pas',
UI_Data in 'WS\UI_Data.pas',
CustomPanelVerpakkingParameter in 'UI\CustomPanelVerpakkingParameter.pas',
- NavProductScherm in 'UI\NavProductScherm.pas' {FormProductNav};
+ NavProductScherm in 'UI\NavProductScherm.pas' {FormProductNav},
+ Navigator in 'UI\Navigator.pas';
{$R *.res}
Index: VerpakkingsDefinitie/UI/NavProductScherm.dfm
===================================================================
diff -u -r592 -r593
--- VerpakkingsDefinitie/UI/NavProductScherm.dfm (.../NavProductScherm.dfm) (revision 592)
+++ VerpakkingsDefinitie/UI/NavProductScherm.dfm (.../NavProductScherm.dfm) (revision 593)
@@ -1,27 +1,86 @@
object FormProductNav: TFormProductNav
Left = 0
Top = 0
+ BorderStyle = bsSingle
Caption = 'FormProductNav'
- ClientHeight = 299
- ClientWidth = 635
+ ClientHeight = 564
+ ClientWidth = 888
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
- DesignSize = (
- 635
- 299)
+ OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
- object PanelMain: TPanel
+ object Splitter1: TSplitter
+ AlignWithMargins = True
+ Left = 360
+ Top = 3
+ Height = 558
+ Margins.Left = 6
+ Margins.Right = 6
+ Beveled = True
+ ExplicitLeft = 375
+ ExplicitTop = 8
+ end
+ object GridPanelLeft: TGridPanel
Left = 0
Top = 0
- Width = 633
- Height = 305
- Anchors = [akLeft, akTop, akRight, akBottom]
+ Width = 354
+ Height = 564
+ Align = alLeft
+ Anchors = []
+ BevelOuter = bvNone
+ Caption = 'GridPanelLeft'
+ Color = clWhite
+ ColumnCollection = <
+ item
+ Value = 100.000000000000000000
+ end>
+ ControlCollection = <>
+ ParentBackground = False
+ RowCollection = <
+ item
+ SizeStyle = ssAbsolute
+ Value = 220.000000000000000000
+ end
+ item
+ Value = 100.000000000000000000
+ end>
+ ShowCaption = False
TabOrder = 0
+ ExplicitLeft = -1
+ ExplicitTop = -8
end
+ object GridPanelRight: TGridPanel
+ Left = 369
+ Top = 0
+ Width = 519
+ Height = 564
+ Align = alClient
+ Anchors = []
+ BevelOuter = bvNone
+ Caption = 'GridPanelRight'
+ Color = clWhite
+ ColumnCollection = <
+ item
+ Value = 100.000000000000000000
+ end>
+ ControlCollection = <>
+ ParentBackground = False
+ RowCollection = <
+ item
+ Value = 100.000000000000000000
+ end
+ item
+ SizeStyle = ssAbsolute
+ Value = 420.000000000000000000
+ end>
+ ShowCaption = False
+ TabOrder = 1
+ ExplicitWidth = 352
+ end
end
Index: VerpakkingsDefinitie/UI/Subscherm.pas
===================================================================
diff -u -r583 -r593
--- VerpakkingsDefinitie/UI/Subscherm.pas (.../Subscherm.pas) (revision 583)
+++ VerpakkingsDefinitie/UI/Subscherm.pas (.../Subscherm.pas) (revision 593)
@@ -8,7 +8,7 @@
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ActnList,
Vcl.ImgList, Vcl.ExtCtrls, Soap.InvokeRegistry, Soap.Rio,
Soap.SOAPHTTPClient, Data.DB, Datasnap.DBClient, Soap.SOAPConn,
- Main, ApplicationContext;
+ Navigator, ApplicationContext;
type
TFormSubscherm = class(TForm)
@@ -32,6 +32,9 @@
Self.ApplicationContext := ApplicationContext;
BorderStyle := bsNone; // Subschermen hebben geen border
+ BevelKind := bkNone;
+ BevelInner := bvNone;
+ BevelOuter := bvNone;
end;
end.
Index: VerpakkingsDefinitie/UI/Util.pas
===================================================================
diff -u -r587 -r593
--- VerpakkingsDefinitie/UI/Util.pas (.../Util.pas) (revision 587)
+++ VerpakkingsDefinitie/UI/Util.pas (.../Util.pas) (revision 593)
@@ -3,13 +3,16 @@
interface
uses
+ Vcl.ExtCtrls, // Control op grid
Vcl.Controls, System.SysUtils, // Free control children
System.Types, Vcl.Graphics; // Color lightener
type
TUtil = class
class procedure VervangControl(OudeControl: TControl; NieuweControl: TControl);
- class procedure FreeControlChildrenDeep(AControl: TControl);
+ class procedure PlaatsControlOpGrid(Grid: TGridPanel; Control: TControl; RowI: Integer; ColI: Integer; RowSpan: Integer = 1;
+ ColSpan: Integer = 1);
+ class procedure FreeControlChildren(AControl: TControl);
class function LightenColor(RGB: Cardinal; Percentage: Integer): Cardinal; static;
end;
@@ -34,33 +37,38 @@
OudeControl.visible := False;
end;
-procedure FreeControlChildrenRec(AControl: TControl);
+// CONTROL OP GRID
+class procedure TUtil.PlaatsControlOpGrid(Grid: TGridPanel; Control: TControl; RowI: Integer; ColI: Integer; RowSpan: Integer = 1;
+ ColSpan: Integer = 1);
+var
+ index: Integer;
begin
- if not Assigned(AControl) then
- exit;
- if AControl is TWinControl then
- begin
- // Tijden het free-en kan zijn dat er elementen verdwijnen uit de lijst.
- // Het aantal elementen moet dus steeds opnieuw gecontroleerd worden (een for-lus berekent dit eenmalig)
- while TWinControl(AControl).ControlCount > 0 do
- FreeControlChildrenRec(TWinControl(AControl).Controls[0]);
- end;
- FreeAndNil(AControl);
+ // Toevoegen aan grid panel op eerste lege plaats (Bij het toevoegen kan dit niet worden gekozen.
+ // Het wordt in de eerste lege plaats gezet)
+ Control.parent := Grid;
+ Control.visible := True; // Staat default op false
+ Control.Align := alClient; // Maakt elementen zo groot als het kan
+ Control.AlignWithMargins := True; // Spacing tussen de schermen
+ // Positie binnen grid aanpassen
+ index := Grid.ControlCollection.IndexOf(Control);
+ Grid.ControlCollection[index].row := RowI;
+ Grid.ControlCollection[index].RowSpan := RowSpan;
+ Grid.ControlCollection[index].Column := ColI;
+ Grid.ControlCollection[index].ColumnSpan := ColSpan;
end;
// FREE CONTROL CHILDREN
// Recursieve methode om de kinderen van een TWinControl te free-en (hanging pointers voorkomen)
// Gebaseerd op: https://stackoverflow.com/questions/414928/is-there-any-way-to-get-all-the-controls-on-a-container-control
-class procedure TUtil.FreeControlChildrenDeep(AControl: TControl);
+class procedure TUtil.FreeControlChildren(AControl: TControl);
begin
- if not Assigned(AControl) then
- exit;
if AControl is TWinControl then
begin
// // Tijden het free-en kan zijn dat er elementen verdwijnen uit de lijst.
// // Het aantal elementen moet dus steeds opnieuw gecontroleerd worden (een for-lus berekent dit eenmalig)
while TWinControl(AControl).ControlCount > 0 do
- FreeControlChildrenRec(TWinControl(AControl).Controls[0]);
+ if Assigned(TWinControl(AControl).Controls[0]) then
+ TWinControl(AControl).Controls[0].Free();
end;
end;
@@ -107,7 +115,8 @@
H, L, S: Double;
R, G, B: Word;
cMax, cMin: Double;
- Rdelta, Gdelta, Bdelta: Word; { intermediate value: % of spread from max }
+ Rdelta, Gdelta, Bdelta: Word;
+ { intermediate value: % of spread from max }
begin
R := GetRValue(RGB);
G := GetGValue(RGB);
@@ -144,7 +153,8 @@
begin
H := (HLSMAX / 3) + Rdelta - Bdelta
end
- else // B == cMax
+ else
+ // B == cMax
begin
H := ((2 * HLSMAX) / 3) + Gdelta - Rdelta;
end;
Index: VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm
===================================================================
diff -u -r570 -r593
--- VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm (.../GevondenProductenScherm.dfm) (revision 570)
+++ VerpakkingsDefinitie/UI/GevondenProductenScherm.dfm (.../GevondenProductenScherm.dfm) (revision 593)
@@ -2,7 +2,7 @@
Left = 0
Top = 0
Caption = 'Gevonden producten'
- ClientHeight = 491
+ ClientHeight = 492
ClientWidth = 317
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -13,17 +13,16 @@
OldCreateOrder = False
OnCreate = FormCreate
OnDestroy = FormDestroy
- DesignSize = (
- 317
- 491)
PixelsPerInch = 96
TextHeight = 13
object ListViewProducten: TListView
Left = 0
Top = 0
- Width = 313
- Height = 489
- Anchors = [akLeft, akTop, akRight, akBottom]
+ Width = 317
+ Height = 492
+ Align = alClient
+ Anchors = []
+ BevelOuter = bvNone
Columns = <
item
Caption = 'Naam'
@@ -56,5 +55,8 @@
TabOrder = 0
ViewStyle = vsReport
OnSelectItem = ListViewProductenSelectItem
+ ExplicitLeft = -4
+ ExplicitWidth = 325
+ ExplicitHeight = 490
end
end
Index: VerpakkingsDefinitie/UI/ProductDetailScherm.dfm
===================================================================
diff -u -r590 -r593
--- VerpakkingsDefinitie/UI/ProductDetailScherm.dfm (.../ProductDetailScherm.dfm) (revision 590)
+++ VerpakkingsDefinitie/UI/ProductDetailScherm.dfm (.../ProductDetailScherm.dfm) (revision 593)
@@ -94,6 +94,8 @@
Top = 259
Width = 792
Height = 416
+ Anchors = [akLeft, akBottom]
+ BevelOuter = bvNone
TabOrder = 1
object Label10: TLabel
Left = 8
Index: VerpakkingsDefinitie/UI/GebruikerScherm.pas
===================================================================
diff -u -r564 -r593
--- VerpakkingsDefinitie/UI/GebruikerScherm.pas (.../GebruikerScherm.pas) (revision 564)
+++ VerpakkingsDefinitie/UI/GebruikerScherm.pas (.../GebruikerScherm.pas) (revision 593)
@@ -6,7 +6,7 @@
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
ObserverPattern,
- UserAgent, Main, ApplicationContext, Subscherm;
+ UserAgent, Navigator, ApplicationContext, Subscherm;
type
TFormGebruiker = class(TFormSubscherm)
@@ -64,7 +64,7 @@
FUserAgent.GebruikerAfmelden(self.ApplicationContext.UserContext);
finally
// Als logout mislukt, gewoon naar inlog scherm gaan. De gebruiker kan dan opnieuw inloggen.
- self.Navigator.NavigeerNaar(Main.NAVLOGIN);
+ self.Navigator.NavigeerNaar(NAVLOGIN);
end;
end;
Index: VerpakkingsDefinitie/UI/ProductDetailScherm.pas
===================================================================
diff -u -r591 -r593
--- VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 591)
+++ VerpakkingsDefinitie/UI/ProductDetailScherm.pas (.../ProductDetailScherm.pas) (revision 593)
@@ -5,7 +5,7 @@
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,
- Subscherm, Main,
+ Subscherm, Navigator,
ApplicationContext,
ObserverPattern, Vcl.ComCtrls, Vcl.CheckLst,
CheckCombo;
@@ -95,7 +95,6 @@
procedure TFormProductDetail.FormCreate(Sender: TObject);
begin
- FProductDetailsSubject.RegisterObserver(FProductDetailsSubjectObserver);
// Vervang sommige comboboxen door TCheckedComboBox
CheckComboBoxPositie := TCheckedComboBox.Create(self);
with CheckComboBoxPositie do
@@ -106,6 +105,9 @@
with CheckComboBoxRichting do
CheckComboBoxRichting.Delimiter := ';';
TUtil.VervangControl(ComboBoxRichting, CheckComboBoxRichting);
+
+ // Registreer bij observer
+ FProductDetailsSubject.RegisterObserver(FProductDetailsSubjectObserver);
end;
procedure TFormProductDetail.FormDestroy(Sender: TObject);
@@ -127,8 +129,7 @@
VorigeIndexInList: Integer;
begin
GeselecteerdProduct := ApplicationContext.ProductsContext.GeselecteerdProduct;
- if (GeselecteerdProduct = nil) or
- (ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count = 0) then
+ if (GeselecteerdProduct = nil) or (ApplicationContext.ProductVerpakkingContext.ProductVerpakkingen.Count = 0) then
begin
UpdateGuiDataAanwezigheid(False);
exit;
@@ -229,7 +230,7 @@
EditAantal.Text := ProductVerpakking.Aantal;
// Parameters
- TUtil.FreeControlChildrenDeep(ScrollBoxParameters);
+ TUtil.FreeControlChildren(ScrollBoxParameters);
for Parameter in ProductVerpakking.Parameters do
begin
NieuweParameterControl := TCustomPanelVerpakkingParameter.Create(ScrollBoxParameters);