On 04.04.2013 17:22, Anton Kavalenka wrote:
test application from http://bugs.freepascal.org/view.php?id=24120
Addit XInitThreads to the initialiization section of second unit after
cthreads allows the test application start.
Funny enough that the windows approach - sending a message (message
would be delivered in a window thread context) does not work here.
WinaAPI approach:
InvalidateRect(Display.Handle, nil, false); // notify window regions
on invalidation
Display.Update; // let the window process its messages
delivers LCL message in context of calling thread.
the only way - TThread.Synchronize(nil,Display.Refresh);
IMO queuing LCL message into main thread message queue can resolve
lots of bugs.
BTW: Moving mouse over the checkbox and button sometimes display their
text in the coloured painted rectangles.
regards,
Anton
http://docencia.etsit.urjc.es/moodle/pluginfile.php/1668/mod_folder/content/1/Slides/GNOME/threads.pdf?forcedownload=1
Multithread programming in GLib/GTK+
GLib is thread-safety when g_thread_init is used
GDK provides gdk_threads_init too that has to be used in
addition to g_thread_init, but it's not always
recommendable
Two options:
* Using *gdk_threads_init*, *gdk_threads_enter()* and *gdk_threads_leave*
* Accessing the program GUI exclusively from the main thread (where
the gtk main loop is running)
The second options is preferable in most of the cases
Anton
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus