AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Fehlermeldung bei Parent-Zuweisung von einer array of TGroupbox
Thema durchsuchen
Ansicht
Themen-Optionen

Fehlermeldung bei Parent-Zuweisung von einer array of TGroupbox

Ein Thema von GeldoderBambo · begonnen am 6. Feb 2018 · letzter Beitrag vom 8. Feb 2018
 
GeldoderBambo

Registriert seit: 6. Feb 2018
2 Beiträge
 
#1

Fehlermeldung bei Parent-Zuweisung von einer array of TGroupbox

  Alt 6. Feb 2018, 20:07
Servus Leute

folgendes Problem:

Im Hauptformular (Form1) erzeuge ich per Buttonclick zur Laufzeit beliebig viele Groupboxen (array of TGroupbox) in Form6.
Delphi-Quellcode:
SetLength(Groupbox4list, i+1);
  Groupbox4list[i] := TGroupbox.Create(Form6);
  Groupbox4list[i].Parent := Form6;
  Groupbox4list[i].Top := 47;
  Groupbox4list[i].Left := 95;
  Groupbox4list[i].Height := 317;
  Groupbox4list[i].Width := 171;
  Groupbox4list[i].Caption := 'Strang ' + IntToStr(i);
  Groupbox4list[i].Anchors := [akBottom,akTop];
  Groupbox4list[i].Font.Style := [fsBold];
Funktioniert alles wunderbar.

Nun möchte ich über einen Buttonclick von Form2 aus, auf den oben erzeugten Groupboxen, nochmals Groupboxen erzeugen:
Delphi-Quellcode:
procedure TForm2.Button2Click(Sender: TObject);

begin

SetLength(Groupbox5list, Form1.i+1);
  Groupbox5list[Form1.i] := TGroupbox.Create(Form6);
  Groupbox5list[Form1.i].Parent := Form6.Groupbox4list[1];
  Groupbox5list[Form1.i].Top := 47;
  Groupbox5list[Form1.i].Left := 95;
  Groupbox5list[Form1.i].Height := 317;
  Groupbox5list[Form1.i].Width := 171;
  Groupbox5list[Form1.i].Caption := 'Strang ' + IntToStr(Form1.i);
  Groupbox5list[Form1.i].Font.Style := [fsBold];

end;
Fehlermeldung in dieser Zeile: (Groupbox5list[Form1.i].Parent := Form6.Groupbox4list[1]: "Zugriffsverletzung bei Adresse 005E600F in Modul..."

Wenn ich den Parent folgendermaßen, auf eine "statische" Groupbox ändere:
Delphi-Quellcode:
SetLength(Groupbox5list, Form1.i+1);
  Groupbox5list[Form1.i] := TGroupbox.Create(Form6);
  Groupbox5list[Form1.i].Parent := Form6.Groupbox1;
  Groupbox5list[Form1.i].Top := 47;
  Groupbox5list[Form1.i].Left := 95;
  Groupbox5list[Form1.i].Height := 317;
  Groupbox5list[Form1.i].Width := 171;
  Groupbox5list[Form1.i].Caption := 'Strang ' + IntToStr(Form1.i);
  Groupbox5list[Form1.i].Font.Style := [fsBold];
funktioniert es auch.

Außerdem funktioniert mein Vorhaben, wenn ich "Groupbox4list.Parent := Form1" anstatt "Groupbox4list.Parent := Form6" schreibe.

Ich hoffe ich habe mich halbwegs verständlich ausgedrückt
Vielen Dank schon mal für eure Mühe!



Form1 Kopf:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
  System.Actions, Vcl.ActnList, Vcl.Grids;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Button1: TButton;
    GroupBox3: TGroupBox;
    Memo1: TMemo;
    Memo2: TMemo;
    Memo3: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Panel1: TPanel;
    GroupBox4: TGroupBox;
    GroupBox5: TGroupBox;
    ComboBox1: TComboBox;
    CheckBox1: TCheckBox;
    Memo4: TMemo;
    Memo5: TMemo;
    Memo6: TMemo;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    GroupBox6: TGroupBox;
    Memo7: TMemo;
    Memo8: TMemo;
    Label16: TLabel;
    Button2: TButton;
    ComboBox2: TComboBox;
    Label17: TLabel;
    Label18: TLabel;
    Panel2: TPanel;
    Label19: TLabel;
    Button4: TButton;
    Button5: TButton;
    Button8: TButton;
    Button9: TButton;
    ScrollBox1: TScrollBox;
    Button3: TButton;
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure ButtonlistClick(Sender: TObject);
    procedure Button2listClick(Sender: TObject);
    procedure PanellistClick(Sender: TObject);
    procedure Panel2listClick(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }

  public
    { Public-Deklarationen }
    Groupbox4list:array of TGroupbox;
    Groupbox5list:array of TGroupbox;
    Button3list :array of TButton;
    panel2list :array of TPanel;
    Scrollboxlist :array of TScrollbox;

    function Spitzendurchfluss (x, y, z, VR: real) : real;
    var x, y, z, VR, VS :real;
    i,p :integer;
    Memozahl : Integer;

  end;

  type
  TGebäudetyp = record
      Bezeichnung : string;
      consta : real;
      constb : real;
      constc : real;

  end;

  TEntnahmestelle = record
    Bezeichnung: string;
    Nennweite: integer;
    Mindestfließdruck: real;
    Berechnungsdurchfluss: real;
    PWH : boolean;
  end;



var
  Form1: TForm1;
  Gebäudeliste : TGebäudeliste;
  Gebäudetyp : TGebäudetyp;
  Entnahmeliste : TEntnahmeliste;
  Entnahmestelle : TEntnahmestelle;
  j :integer;



implementation


uses Math, Unit2, Unit3, Unit4, Unit5, Unit6, Unit7;
{$R *.dfm}

Form6 Kopf:
Delphi-Quellcode:
unit Unit6;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;

type
  TForm6 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Button1: TButton;
    Button2: TButton;
    GroupBox2: TGroupBox;
    Panel5: TPanel;
    Label19: TLabel;
  private

    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  //Stränge Eingabe Form 6
  Groupbox4list :array of TGroupbox;
  Scrollboxlist :array of TScrollbox;
  Groupbox5list :array of TGroupbox;
  Button3list :array of TButton;
  //Panel Stränge für Auswahl
  panel2list :array of TPanel;
  end;

var
  Form6: TForm6;

implementation

{$R *.dfm}

uses Unit1, Unit5, unit2;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz