[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cell-select in sequence-dialog-items
- To: info-mcl@cambridge.apple.com
- Subject: Re: cell-select in sequence-dialog-items
- From: lynch@ils.nwu.edu
- Date: Thu, 20 Aug 92 14:42:15 CDT
>I'm noticing that, contrary to my intuitive expectations,
>sequence-dialog-items in MCL 2.0 do not call CELL-SELECT when the user
>selects a cell by clicking on it. Cells become highlighted and added
>to the list returned by SELECTED-CELLS, but the CELL-SELECT method
>itself does not appear to be called.
>
>I had hoped to specialize an :after method for this generic function
>(and for cell-deselect) on a subclass of sequence-dialog-item that
>would accomplish the behavior of activating a few buttons when and
>only when one or more items in a table were selected. It seems like
>CELL-SELECT and CELL-DESELECT are a more logical place to put this
>behavior than on VIEW-CLICK-EVENT-HANDLER, since sometimes cells might
>be selected or deselected other than by clicking. (i.e. by typing
>characters as in the select file dialog, or by program action)
A very common gotcha.
Unfortunately, this has been true and known to the MCL developers since AT
LEAST MACL 1.3.2. My advice is to just go ahead and bastardize
view-click-event- handler...
UNLESS you think you really are going to use program action to select or
deselect cells. At that point, believe me, you are better off writing your
own sequence-dialog-item. Unfortunately, I did it the other way and regret
it every time something comes up that has to be changed for the classes
involved.
WARNING: There are *other* methods that are for "external use only". A
colleague claims to have seen some sort of indication as to which were
which in the documentation at some time, but I make no claims as to the
truth-value of this statement as I avoid reading docs as much as possible.
:-)
I am unsure at this point which methods these are, but I seem to recall
having serious fights with:
cell-select/cell-deselect (problems you noted above.)
cell-position (I wanted to draw a deck of cards in fan-fold; should be
simple)
cell-size? (I'll be damned if I can remember how this screwed up.)
view-[de]activate-event-handler
(it frames[inverts] the rect of the selected cells; I contend that should
be
done by draw-cell-contents for modularity.)
view-click-event-handler or cell-select also call invert-rect directly on
the "internal double-secret" versions of cell-position and cell-size.
Thus, if you want custom drawing of a sequence-dialog-item, you're in for a
real interesting time.
As much as I like the MCL programming environment, I have to say that
between the simple-view/view and focusing problems, as well as some serious
non-modularity (like this); the various windowing widgets are due for a
big overhaul.
This is not meant as a flame. The flaws like this have only been found by
pushing MCL to the limit, but they are there.
PS: If, perchance, you *do* roll your own sequence-dialog-item, I would
also recommend that it be a sequence-view (ie subclass of view, not
dialog-item). I would also like to see it archived if that would be OK.
"TANSTAAFL" Rich lynch@ils.nwu.edu