AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Panel.Controls auf TShape prüfen

Ein Thema von Helmi · begonnen am 20. Apr 2008 · letzter Beitrag vom 20. Apr 2008
Antwort Antwort
Benutzerbild von Helmi
Helmi

Registriert seit: 29. Dez 2003
Ort: Erding, Republik Bayern
3.312 Beiträge
 
Delphi XE2 Professional
 
#1

Panel.Controls auf TShape prüfen

  Alt 20. Apr 2008, 08:18
Hallo,

ich steh grad auf dem Schlauch:

Ich lauf mit einer Schleife über alle Controls dir auf einem Panel liegen
und will vergleichen on ein Control ein TShape ist.

Irgendwie hab ich momentan einen Gedankenfehler.

Delphi-Quellcode:
  
for i := 0 to Pred(Panel_MSST.ControlCount) do
    begin
      Dummy_Shape := Panel_MSST.Controls[i] as TShape; //funkioniert nicht
Wie kann ich prüfen ob das Control ein TShape ist.

BTW.: Ich hab schon Panel.Components ausprobiert
aber das funktioniert nicht (ComponentsCount = 0)
mfg
Helmi

>> Theorie ist Wissen, dass nicht funktioniert - Praxis ist, wenn alles funktioniert und keiner weiss warum! <<
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: Panel.Controls auf TShape prüfen

  Alt 20. Apr 2008, 08:28
if Panel_MSST.Controls[i] is TShape then
Thomas
  Mit Zitat antworten Zitat
Benutzerbild von Helmi
Helmi

Registriert seit: 29. Dez 2003
Ort: Erding, Republik Bayern
3.312 Beiträge
 
Delphi XE2 Professional
 
#3

Re: Panel.Controls auf TShape prüfen

  Alt 20. Apr 2008, 08:33
Danke!

is gibts ja auch noch
mfg
Helmi

>> Theorie ist Wissen, dass nicht funktioniert - Praxis ist, wenn alles funktioniert und keiner weiss warum! <<
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#4

Re: Panel.Controls auf TShape prüfen

  Alt 20. Apr 2008, 09:38
Zitat von toms:
if Panel_MSST.Controls[i] is TShape then
Nachtrag:

Nach der "is"-Überprüfung kannst du anstatt eines Soft Casts einen Hard Cast machen:

Also anstatt:

Delphi-Quellcode:
if Panel_MSST.Controls[i] is TShape then
begin
  Dummy_Shape := Panel_MSST.Controls[i] as TShape;
end
so:

Delphi-Quellcode:
if Panel_MSST.Controls[i] is TShape then
begin
  Dummy_Shape := TShape(Panel_MSST.Controls[i]);
end
Thomas
  Mit Zitat antworten Zitat
Benutzerbild von Helmi
Helmi

Registriert seit: 29. Dez 2003
Ort: Erding, Republik Bayern
3.312 Beiträge
 
Delphi XE2 Professional
 
#5

Re: Panel.Controls auf TShape prüfen

  Alt 20. Apr 2008, 09:43
Danke!
mfg
Helmi

>> Theorie ist Wissen, dass nicht funktioniert - Praxis ist, wenn alles funktioniert und keiner weiss warum! <<
  Mit Zitat antworten Zitat
Antwort Antwort


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 05:42 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz