I was using synchronize, but as I figured out today, I was using it incorrectly. With a bit of fiddling today I managed to get it working; both with the progress bar updating and the GUI not hanging. Thanks.
On Sun, Nov 29, 2009 at 4:32 AM, Mattias Gaertner <[email protected] > wrote: > On Sat, 28 Nov 2009 22:05:26 -0500 > Matt Shaffer <[email protected]> wrote: > > > I was reading up on threads in FPC, and the wiki even mentioned them > being > > used to prevent the GUI from locking up (which is what I wanted to do). I > > quickly stitched together the multithreaded example with my app (which is > a > > simple image conversion program using fpimage), but the gui still hung > when > > converting images, preventing the window from being moved and the > progress > > bar from updating. I even made a thread whose sole purpose was to do > > Application.ProcessMessages every millisecond to ensure the darn thing > would > > respond -- no luck. > > The main thread must be the GUI thread. > If the main thread is busy, you can use Application.ProcessMessages. > Other threads should never use Application.ProcessMessages directly. > If other threads should effect some gui elements (read/write > properties), use Synchronize. > > http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial > > > > So my question is: Does anyone have an actual example of preventing a GUI > > (currently on Windows) from locking up when executing a large chunk of > code? > > Or does anyone feel like wading through my frankenstein code? > > > Mattias > > -- > _______________________________________________ > Lazarus mailing list > [email protected] > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
