Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x Frequently Asked Questions (FAQ) 7/7
Section - 160) What's the difference between actions and callbacks?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Restaurant inspections ]


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 159) Where can I get documentation on Xaw, the Athena widget set?
Next Document: 161) How do I simulate a button press/release event for a widget?
See reader questions & answers on this topic! - Help others by sharing your knowledge

Actions and callbacks may be closely tied; the user may click a mouse-button
in an object's window, causing an action procedure in that particular object
to be called. As part of its processing of the event, the action procedure
may inform the application via a callback registered on the object. However,
callbacks can be given for any reason, including some that don't arise as a
result of user action; and many actions don't result in any notification to
the application.

Callbacks generally are a means of interaction between the user interface
(UI) and some other piece of code interested in the "results"; the interested
party to which the data is communicated is usually the application's back-end
functions but may be another widget in a related part of the UI.  For
example, a text widget invokes a callback to say "the user just entered this
text string; never mind what I had to do to get it or what X events took
place."

In object-oriented programming terminology, callback lists are messages
defined by the widget class by which the widget instance notifies another
entity that something significant has happened to the widget.

Actions, however, constitute a widget's repertoire of internal i/o
behaviors.  Actions are not about results; actions are about "how", not
"what" gets done. The text widget may define a dozen or two actions which
define how the user can manipulate the text; the procedures for removing a
line of text or switching two words can be associated with particular X event
sequences (and in fact often rely on particular types of events).

Actions are (in OOP terminology) methods of the widget class by which the
widget responds to some external stimulus (one or more X events).

To avoid confusing yourself on the issue of actions vs. callbacks, try
thinking of actions defined by an application as methods *of the application*
-- applications may define actions, as well -- by which the application
responds to one or more X events (and happens to be handed an object handle
as part of the method argument list). Similarly, callback handlers registered
by an application with a widget can be thought of as methods of the
application which respond to messages from a widget or widgets.

[Thanks to Michael Johnson (michael@maine.maine.edu) and to Kerry Kimbrough]

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 159) Where can I get documentation on Xaw, the Athena widget set?
Next Document: 161) How do I simulate a button press/release event for a widget?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)





Last Update March 27 2014 @ 02:12 PM