On 20/04/11 11:55, Bernd wrote:
2011/4/20 Henry Vermaak<[email protected]>:

See here for a related issue:

http://bugs.freepascal.org/view.php?id=13120

You'll have to wake up the main thread after the frame (which is what your
timer is doing).  For gtk you can use
g_main_context_wakeup(g_main_context_default), for qt there is
QEventLoop::wakeUp().

Thank you, this is what I have read a while ago but could not find
anymore due to the wrong serch terms.

But it does not seem to help :-(

Hmm, that's strange. This works for me. I've written a c lib that notifies me of usb devices getting plugged in. The callback from the lib looks like this:

procedure NotifyPlug(status: cint); cdecl;
begin
  Application.QueueAsyncCall(@Form1.NotifyAsync, status);

  {$ifdef lclgtk2}
  g_main_context_wakeup(g_main_context_default);
  {$else}
  PostMessage(Form1.Handle, LM_PAINT, 0, 0);
  {$endif}
end;

Does it make a difference if you define usecthreads? Perhaps you can try postmessage, too, just to rule out a bug with the QueueAsyncCall implementation. Postmessage (at least on gtk) will wake up the main thread (make sure you define usecthreads for this, though).

Henry

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to