Event-Driven Programming

team bbl


When programmers encountered an Apple Macintosh for the first time, they were astonished at how different it was from the conventional computer experience of the period. Moving the pointer from one window to another, playing with scrollbars, menus, text controls and so on, it was hard to imagine how the underlying code sorted out this fabulous complexity. It seemed that many different things were going on in parallelin reality, a clever illusion. For many people, the Macintosh was their first introduction to the world of event-driven programming.

All GUI applications are event-driven. That is to say, the application sits in a loop waiting for events initiated by the user or from some other source (such as a window needing to be refreshed, or a socket connection), and then dispatches the event to an appropriate function that handles it. Although it may seem that windows are being updated simultaneously, most GUI applications are not multithreaded, so each task is being done in turnas becomes painfully obvious when something slows your computer to a crawl and you can see each window being repainted, one after the other.

Different frameworks have different ways of exposing event handling to the developerthe primary method in wxWidgets is the use of event tables, as explained in the next section.

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net