Of course you can use "events" (aka class properties that are functions) in threads. That is just the Object Pascal syntax. But in the main thread in Delphi or Lazarus events of GUI objects (e.g. TButtons) are called "automatically" by user actions (thus in effect by hardware events, which cause messages in Windows). This is not possible with threads in Delphi, as system messages are sent to the main (GUI) thread of a project. A thread can _programmatically_ wait for a message, but the Delphi (and Lazarus) event scheduler that calls events of GUI based objects only works for the main thread.I can't call callbacks in threads? Why's that? Or am I understanding something wrong? In Delphi this is done by system messages, so no permanent polling (spinning) but using a wait for message Windows API. I don't know how this is done in Kylix or Lazarus/Linux.and if you go single-threaded you have to provide the main loop hooks).Do I? I always thought a timer is more comparable to an interrupt or signal than a polling loop. IMHO this should be done following the Delphi paradigms to be nice to Delphi users coming over to FCP (only enhancement allowed). Of course Lazarus does this, but IMHO it would be great to have this in a system without a GUI, too.Well, for me it would have saved me some time which I wasted in creating threads that implement "timing events" by simply sleeping for a particular time. -Michael |
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel