unit NavGridPanel; interface uses Vcl.Controls, Vcl.ExtCtrls, System.Classes, Main, ApplicationContext; type TNavGridPanel = class(TGridPanel) public procedure PlaatsControlOpGrid(Control: TControl; RowI: Integer; ColI: Integer; RowSpan: Integer = 1; ColSpan: Integer = 1); end; TNavGridPanelStandard = class(TNavGridPanel) public procedure Init(Bovenaan : TControl; Links1:TControl; Links2:TControl; Rechts:TControl); end; implementation procedure TNavGridPanel.PlaatsControlOpGrid(Control: TControl; RowI: Integer; ColI: Integer; RowSpan: Integer = 1; ColSpan: Integer = 1); var index: Integer; begin // 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 := self; 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 := self.ControlCollection.IndexOf(Control); self.ControlCollection[index].row := RowI; self.ControlCollection[index].RowSpan := RowSpan; self.ControlCollection[index].Column := ColI; self.ControlCollection[index].ColumnSpan := ColSpan; end; procedure TNavGridPanelStandard.Init(Bovenaan : TControl; Links1:TControl; Links2:TControl; Rechts:TControl); // Boven, links, links, rechts const colLeftSize: Integer = 375; rowTopSize: Integer = 40; rowMidSize: Integer = 200; begin // Rijen en kolommen toevoegen self.RowCollection.BeginUpdate; self.ColumnCollection.BeginUpdate; self.RowCollection.Clear; self.ColumnCollection.Clear; // Balk bovenaan met vaste hoogte voor gebruikersgegevens with self.RowCollection.Add do begin SizeStyle := ssAbsolute; Value := rowTopSize; end; // Daaronder links opzoek scherm met vaste hoogte with self.RowCollection.Add do begin SizeStyle := ssAbsolute; Value := rowMidSize; end; // Daaronder het resultaten scherm, dit schaalt automatisch with self.RowCollection.Add do begin // De Autosize optie zou kijken naar het child. Hier is het de bedoeling dat het Grid Panel maximaal groeit. SizeStyle := ssPercent; Value := 100; end; // Linkerhelft van de schermen heeft vaste breedte with self.ColumnCollection.Add do begin SizeStyle := ssAbsolute; Value := colLeftSize; end; // Rechterhelft is volledig voor detail scherm with self.ColumnCollection.Add do begin // De Autosize optie zou kijken naar het child. Hier is het de bedoeling dat het Grid Panel maximaal groeit. SizeStyle := ssPercent; Value := 100; end; self.RowCollection.EndUpdate; self.ColumnCollection.EndUpdate; // Schermen op GridPanel plaatsen // PlaatsControlOpGrid(Control; RowI; ColI; (opt) RowSpan; (opt)ColSpan); // Scherm bovenaan. self.PlaatsControlOpGrid(Bovenaan, 0, 0, 1, 2); // Daaronder links self.PlaatsControlOpGrid(Links1, 1, 0); // Daaronder links self.PlaatsControlOpGrid(Links2, 2, 0); // Rechts is helemaal self.PlaatsControlOpGrid(Rechts, 1, 1, 2); end; end.