I'm not sure I see the value behind these ideas.
 
If you need an event-based loop and callbacks you can make TApplication. If you don't want LCL ok, then make your own, it's generaly needed to be very problem-specific anyhow, eg: the TLEventers I use are ment for handling events on handles (files and sockets atm, sockets only in windows).
 
If you want a "Timer" a "polling" mechanism has to take place which looks if something happened on some timer for example, OnTimer is "ready to be fired" (you can't call callbacks in threads, and if you go single-threaded you have to provide the main loop hooks).
 
So basicly, let's say TTimer is in RTL and there's some event mechanism already too, you'd have to do something like this:
 
procedure init;
begin
  Timer.Timeout:=somenumber;
  Timer.OnTimer:[EMAIL PROTECTED];
  EventHandler.RegisterTimer(Timer); // could be the other way around
end;
 
procedure MainLoop;
begin
  EventHandler.HandleEvents; // if eventhandler after polling all timers in it's watchlist find out some has it's interval done, it fires it's callback
end;
 
begin
  Init;
  MainLoop;
end.
 
 
Apart from asynchronous stuff like watching handles etc. I don't see much use for this relativly complicated program model. Remember you need to call the "HandleEvents" as fast as possible to stay effective (otherwise you lose precision)
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to