Thema: Delphi Property Typ ermitteln

Einzelnen Beitrag anzeigen

moelski

Registriert seit: 31. Jul 2004
1.110 Beiträge
 
Delphi 2010 Professional
 
#1

Property Typ ermitteln

  Alt 27. Mär 2009, 13:15
Moin !

Ich habe da ein Stück Code (C = TComponent):
Delphi-Quellcode:
    if IsPublishedProp(C, 'Items') then begin
      SubNode := XMLDoc.SelectSingleNode('/Language/' + Form.Name + '/' + C.Name + '/Items');
      ...
      SetCDataChild(SubNode, (GetObjectProp(C, 'Items') as TStrings).Text);
    end;
Das funzt auch ganz gut. Allerdings gibts da ein kleines Problem. Items kann vom Typ TStrings sein aber ein Popupmenü hat auch eine Items Property die ist aber nicht vom Typ TStrings. Das kanllt natürlich.

Wie kann ich nun überprüfen ob Items auch wirklich vom Typ TStrings ist?
Geht das irgendwie mit PropType? Folgendes geht jedenfalls mal nicht:
PropType(C, 'Items') = TStrings Ist aber auch klar, weil PropType was ganz anderes zurück liefert ...

Any hints ?
Dominik Schmidt
Greetz Dominik

I love Delphi 2007/2010
  Mit Zitat antworten Zitat