>
>
> > It is early days for me and i need to see how to properly=20
> > embed my code in an event loop, because i asked a for loop to=20
> > output a count using the method we have discussed, the thing=20
> > is if i put a high count in the window hangs and does not=20
> > display until the count is complete, even though the show()=20
> > function was already called in the constructor,
>
> Yup - that's something that many people trip over when getting into GUI
> programming.
>
> If you make a tight loop that doesn't yield the process to the GUI at
> any point, the GUI will not be redrawn, so...
>
> It's tricky, and requires you to think about coding the problem
> differently from what you might do in a simple case.
> Generally, long processes that occur in the same thread as the GUI are
> anathema - you need to find another way.
>
> The GUI updates can be pumped "synchronously" from inside your loop by
> calling Fl::check(); every few hundred iterations, but that's actually a
> pretty poor solution to the problem.
>
> A better approach would be to do it asynchronously, either via threading
> or by use of the Fl timeout methods to update things suitably.
>
> There are examples out there, of course, I think Greg's site has a few
> for example, so I'm sure you'll find what you need.
>
>
>
>
> SELEX Galileo Ltd
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS=
> 14 3EL
> A company registered in England & Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
>
>
> > It is early days for me and i need to see how to properly=20
> > embed my code in an event loop, because i asked a for loop to=20
> > output a count using the method we have discussed, the thing=20
> > is if i put a high count in the window hangs and does not=20
> > display until the count is complete, even though the show()=20
> > function was already called in the constructor,
>
> Yup - that's something that many people trip over when getting into GUI
> programming.
>
> If you make a tight loop that doesn't yield the process to the GUI at
> any point, the GUI will not be redrawn, so...
>
> It's tricky, and requires you to think about coding the problem
> differently from what you might do in a simple case.
> Generally, long processes that occur in the same thread as the GUI are
> anathema - you need to find another way.
>
> The GUI updates can be pumped "synchronously" from inside your loop by
> calling Fl::check(); every few hundred iterations, but that's actually a
> pretty poor solution to the problem.
>
> A better approach would be to do it asynchronously, either via threading
> or by use of the Fl timeout methods to update things suitably.
>
> There are examples out there, of course, I think Greg's site has a few
> for example, so I'm sure you'll find what you need.
>
>
>
>
Right, i realised last night i was probably going to get held up with
rethinking program design, it seems like it is a trade off at the moment
between being able to very quickly build my interface, yet having to relearn
how to interact with it....or having to draw my own buttons and call all my own
rendering using a graphics
API, yet knowing i can 'quickly' implement the working program once i have
everything ready image-wise.
normally i would do something like
main()
{
while not quit
{
handle events
switch event
case clicked on start
do algorithm
break
case //...
case //...
update screen
}
}
As a simple example.
i would generally use a design like a state engine and virtual methods to fully
implement this.
What are the main differences between the GUI program flow and the type shown
above?
Cheers for any input.
I am itching to get actually coding on this project as it is already fully
written as a console app, i just have to get these tools in place to get
started.
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk