On 4 Jul 2010, at 12:48, Alexander Walz wrote: > I would like to display strings generated by Lua in real-time in a > Fl_Text_Display or > Fl_Browser object. > > My Lua programmes sometimes consume a lot of computing power but > should write any intermediate > results of the calculations immediately in a FLTK window. > > However, only after the whole computation finishes, the output is > displayed. Even the > title bar of the output window appears after the computation ends.
I see that Albrecht has already posted some suggestions that seem to have worked for you, but I thought I'd add another suggestion... If it were me, I'd have the fltk code spawn another thread, and run the lua interpreter in that subsidiary thread. That would then allow the fltk thread and the lua thread to proceed simultaneously, so the fltk windows should then remain responsive and update without needing to be "pumped" by calling Fl:check() all the time. There's some added complexity with doing IPC between the threads of course, but over all I believe it is simpler and more efficient (especially on modern hardware where hyper-threading and/or multi- core CPU's are the norm.) > Object-oriented programming is new to me, as is GUI programming, so > please be patient > with me. I have not programmed any `update output` callback > function yet. OK - then my threads suggestion might be a step too far, perhaps. I still think it is worth considering however. Hope that was helpful anyway - or at least interesting! -- Ian _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

