gettingstarted
[Top] [All Lists]

Re: Active window

To: <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Active window
From: Lars Jensen <larsjensen at rcn dot com>
Date: Mon, 29 Nov 2004 13:34:48 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
> Should "return True"  be also added to the app menu handlers? or just
> the window handlers?

It should be added to any handler -- whether in an app, a window, or a
control -- that deals with a menu selection such that the menu selection
should not be passed to the next thing in line.

Example: If your window has a FilePrint menu handler that puts up a dialog,
then it should return true, whether the user cancels the dialog or not. Even
though ultimately nothing got printed, the menu selection itself was
handled; i.e. the FilePrint handler took responsibility for all subsequent
processing.

Contrast this with an Event (noting that a menu handlers is basically a
specialized kind of event) like KeyDown. This returns a Boolean indicating
"handled" just like a menu handler, and it is not uncommon for, say, an
EditField to handle certain keys but not others, so its KeyDown event would
sometimes return true and sometimes false.

In practice, most menu handlers return true, whereas with Events it's more
situation-dependent. The difference is that Events are predefined for all
controls whether they are used or not, but Menu Handlers are added by the
programmer only as needed, and it's unusual for a menu selection to be
examined and passed on.

lj

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>