The problem is that when I use queue.Items [0] .is_alive (), I get an Error: Illegal qualifier error message.
This is because the compiler has no idea that queue.items[0] is different from a common pointer (see below).
Now I am doing the following: queue.Add (CNotif.create (timer, title, text, icon)), but I don't think it should be done that way.
This is exactly what you need. CNotif.Create creates a new object, and this object is omitted from TObject . It compiles fine because your call to queue.Add expects a pointer, and the Delphi / FreePascal variable containing the instance of the object is actually a pointer. (Both languages obscure the need for dereferencing with MyObj^ for us.)
To use something in queue.Items , you need to tell the compiler that there, besides the general pointer (which, of course, does not have the is_alive method). You do this by typecasting:
CNotif(queue.Items[0]).is_alive
Note: there is a shorter way to use TList.Items ; Items declared as the default property for TList , so you can omit it:
queue[0]
coincides with
queue.Items[0]
and much easier to type.
source share