Event driven function

What is the difference between custom defined functions and event driven functions??
closed account (Lv0f92yv)
It's not so much a difference necassarily in their 'definition', but how the function is called.

In normal top-down programming, functions are called by events that happen from inside your code. In an event-driven environment, functions in your code are typically called by user input (IE they click a button, fill in a field& hit enter, drag the window, etc).

The functions can be defined in the same way (in your code of course), but the difference between an event-drivin function and a traditional function is that event-driven functions are often called by user-determined behavior, rather than being executed at a specific point in your code.

Your web-browser (and most GUIs) are event-driven. When you click the 'Home' button at the top, you are generating an 'event' to the browser program. It responds by calling a function based on the event (in java, usually a MousePressed or MouseClicked method associated with an ActionListener). Other than responding to what you did, your program has no way of knowing when this event was going to be generated (and thus when the appropriate function(s) were going to be called).
Is it possible to write my own event-driven function for console app?
Topic archived. No new replies allowed.