BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RTTI, GetProp not working as I wish it would

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Nikola Jankoviæ
Guest





PostPosted: Sat Jan 21, 2006 6:22 pm    Post subject: RTTI, GetProp not working as I wish it would Reply with quote



I sincerely hoped that something like:

procedure TBaseObjList.FilterByDate(propName: string; startDate, endDate:
TDateTime);
var
i: Integer;
prop: TDateTime;
begin
for i:= Count-1 downto 0 do
begin
prop:= TDateTime(GetObjectProp(TBaseObj(Items[i]),propName));
if (prop < startDate) or (prop > endDate) then
Remove(TBaseObj(Items[i]));
end;
end;

procedure TBaseObjList.FilterByProperty(propName: string; propValue: string);
var
i: Integer;
begin
for i:= Count-1 downto 0 do
begin
if GetStrProp(TBaseObj(Items[i]),propName) <> propValue then
Remove(TBaseObj(Items[i]));
end;
end;

would work, but it doesn't. I get EPropertyError that property does not exist,
although it does and it is published (in second example), and incompatible types
(in first).

Please help me make it work.

Thanks in advance
nikola
Back to top
Rob Kennedy
Guest





PostPosted: Sat Jan 21, 2006 8:47 pm    Post subject: Re: RTTI, GetProp not working as I wish it would Reply with quote



Nikola Janković wrote:
Quote:
I sincerely hoped that something like:

procedure TBaseObjList.FilterByDate(propName: string; startDate, endDate:
TDateTime);
var
i: Integer;
prop: TDateTime;
begin
for i:= Count-1 downto 0 do
begin
prop:= TDateTime(GetObjectProp(TBaseObj(Items[i]),propName));

I feel as though I just answered this somewhere else.

http://groups.google.com/group/borland.public.delphi.language.delphi.win32/browse_thread/thread/9afd37605a4fdf96/370ea9dae82a213d

--
Rob

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.