Descendant of TList

Hi all,

In one of my Apps, I use a class that is a descendant of TList. So, how can I call a procedure everytime the count property of my class has changed?

regards
rene
LVL 2
rene100Asked:
Who is Participating?
 
rwilson032697Connect With a Mentor Commented:
Override the add/delete/remove methods and call your procedure from those overridden methods.

eg:
// in class declaration
  procedure Add(Item : Pointer); Override;

// in main body
  procedure Add(Item : Pointer);
  begin
    Inherited Add(Item);
    DoMyThing;
  end;


0
 
rwilson032697Commented:
Oops, there are a couple of problems:

eg:
    // in class declaration
      procedure Add(Item : Pointer);

    // in main body
      procedure TMyList.Add(Item : Pointer);
      begin
        Inherited Add(Item);
        DoMyThing;
      end;

Cheers,

Raymond.
0
 
rene100Author Commented:
Thanks for your help!
0
All Courses

From novice to tech pro — start learning today.