AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi TPanel-Nachfahr Probleme: ComboBox.Items.Add in constructor
Thema durchsuchen
Ansicht
Themen-Optionen

TPanel-Nachfahr Probleme: ComboBox.Items.Add in constructor

Ein Thema von Nuclear-Ping · begonnen am 18. Aug 2004 · letzter Beitrag vom 18. Aug 2004
 
Nuclear-Ping
(Gast)

n/a Beiträge
 
#1

TPanel-Nachfahr Probleme: ComboBox.Items.Add in constructor

  Alt 18. Aug 2004, 13:37
Hallo,

ich will mir einen Nachfahren von TPanel ableiten, der u.A. zwei ComboBoxen in sich trägt.

Die Deklaration schaut so aus:
Delphi-Quellcode:
type
  TVisualGlobalScalingCalculator = class(TPanel)
    constructor Create (AOwner: TComponent); override;
    ...
  private
    { Private-Deklarationen }
    ...
 
    FPhaseShiftCombo,
    FYSelectCombo: TComboBox;
 
  ...
  end;
Der constructor so:

Delphi-Quellcode:
 { ************************************************************ }
constructor TVisualGlobalScalingCalculator.Create (AOwner: TComponent);
{ ************************************************************ }
begin
  inherited Create (AOwner);
 
  // -------------------------------------------------
 
  FGageSelectPanel := TPanel.Create (Self);
  FFormularPanel := TPanel.Create (Self);
 
  // -------------------------------------------------
 
  ...
  FYSelectCombo := TComboBox.Create (FGageSelectPanel);
 
  // -------------------------------------------------
 
  ...
 
  // -------------------------------------------------
 
  FPhaseShiftCombo := TComboBox.Create (FFormularPanel);
 
  // -------------------------------------------------
 
  ...
 
  // -------------------------------------------------
 
  with FYSelectCombo do
    begin
      Parent := FGageSelectPanel;
      Name := 'FYSelectCombo';
      Style := csDropDownList;
 
      OnChange := GageChangeEvent;
      OnSelect := GageChangeEvent;
 
// Items.Add ('test'); <<-- Fehler
    end;
 
  // -------------------------------------------------
 
  ...
 
  // -------------------------------------------------
 
  with FPhaseShiftCombo do
    begin
      Parent := FFormularPanel;
      Name := 'FPhaseShiftCombo';
      Style := csDropDownList;
 
// Items.Add (' 0.0'); <<-- Fehler
// Items.Add (' 1.5');
// Items.Add ('-1.5');
    end;
 
  // -------------------------------------------------
 
  ...
 
end;
Im Konstruktor sollen also Standardwerte in die ComboBoxen aufgenommen werden. Jedoch verursacht er bei den (nun) auskommentierten "Items.Add"-Anweisungen eine Fehlermeldung: "Element '' hat kein übergeordnetes Fenster.", wenn ich die Komponente auf die Form ziehe.

Allerdings sind alle Parent-Zuweisungen korrekt und später lassen sich auch ohne Probleme Items zu den ComboBoxen hinzufügen.

Wo liegt hier der Fallstrick und wie kann ich im Konstruktor den ComboBoxen Standardwerte geben?

Vielen Dank im Vorraus,
Mario
  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 10:07 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