[fpc-pascal]How to write GUI programs?

Fernando Lozano fsl at centroin.com.br
Wed Sep 11 00:19:47 CEST 2002


> On Tue, Sep 10, 2002 at 07:44:28AM +0200, Rainer Hantsch wrote:
> > -> Because I have absolutely no knowledge about GUI programming, I must learn 
> >    this from scratch. I only experienced that here everything goes otherwise
> >    round: While a normal text application is controlled by keystrokes and you
> >    have to read them within you program, it seems that GUI programs have an
> >    external handler in the GUI library and this one does callbacks - I never
> It depends on the gui api you are using. Some require you to run your own 
> (delayed)event loop checking for gui events, or using a wait alike command which 
> waits for an event, within a loop. Then you check what caused the event and start the 
> function according to that. After that it returns to the wait command after it 
> completed the loop.

If you use GTK+ this is the gtk_main procedure. It'll do an event loop (until gtk_main_quit sets a flag that ends the loop) and call the event handler routines defined by previous calls to gtk_signal_connect. Anytime on your app (that is, inside any event handler) you can call gtk_signal_connect to define new event handlers, say for windows you've just created like dialog boxes.

[]s, Fernando Lozano

More information about the fpc-pascal mailing list