[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gui changes.

From: Nicola Pero
Subject: Re: gui changes.
Date: Thu, 22 Mar 2001 21:52:16 +0000 (GMT)

Mirko> I've updated the gui to support the dotted rectangle (now as a
Mirko> simple rect) for cell's first responder status and ...

Ciao Mirko,

every time I look at the Mac OS X doc for NSCell - the methods
containing responder in the name - I get the feeling that they got it
wrong.  I know - it's not your fault at all - you did well.

Read the doc for NSCell -setShowsFirstResponder:

"Sets whether the receiver displays a dotted-line outline when it
assumes first responder status."

That's a heap of rubbish.  A cell is *not* a responder, and so it can
*never* assume first responder status.  The fact that a cell is not a
responder is a precise design decision which is deeply built in the
openstep API - it is an integral part of the cells/controls design.
They clearly don't get it and this method makes no sense at all.

You have understood (and implemented) the sentence as saying `Sets
whether the receiver displays a dotted-line outline when the
associated control assumes first responder status.'.  The problem is -
in this way you can implement what the sentence says, but it is an
ugly meaningless design, because when you have a control with more
than one cell (which btw should be considered the norm), then if the
control assumes first responder status, all cells draw a dotted
outline, while when the control resigns first responder, all cells do
not draw their dotted outline any longer.  That makes no sense because
you want a single cell, the one on which the attention is, to get the
dotted line, and the other to get no dotted line.

I think you figured out this problem by yourself when implementing
NSBrowserCell - you had to fight with the meaningless superclass
implementation and force in by hacking a different behaviour.  We
can't leave that code that way.

The correct totally natural and obvious design is - 

a cell should have a state variable which determines whether it draws
a dotted outline or not.  This variable can be set/read by using
something like -setDrawsDottedOutline:, -drawsDottedOutline.  The cell
takes *no* decision whatsoever about responders; it just implements
the code to draw the dotted outline, and that code can be turned on
and off by calling setDrawsDottedOutline:.  That's a cell's task.

a control manages its cells responding to user actions, and according
to user action and to what happens in the window, decides which cells
should draw the dotted outline and which should not.  It calls the
method -setDrawsDottedOutline: on the cells when it wants to tell them
to draw the outline.  That is the control's task.

It would make sense to have the method -setShowsFirstResponder: in the
*control*.  That would determine whether the control draws the dotted
outline [ask the cells to draw the dotted outline] around its cells
when needed, or if this would be disabled.

I'm wondering - could someone make some experiments and tell us
exactly how the Apple stuff work ?

It might be that the documentation is wrong, and that they actually
implement setShowsFirstResponder: in the way I described
-setDrawsDottedOutline:.  Frankly, I don't think so, they probably
made it really wrong, also considering that in NSCell they have
produced that extraordinary masterpiece of shit confusing API which is
the presence of *both* `acceptsFirstResponder' and
`refusesFirstResponder' in a class which is not a responder and so
never takes on first responder status (and which already had methods
to do this kind of things - see `isEnabled').  I agree to keep these
methods in gnustep for source compatibility with apple - but we must
deprecate them and ban them - because they are design bugs.

So, we need to build a better, more openstepish, API, and still keep
source compatibility.

I suggest using setDrawsDottedOutline: drawsDottedOutline in our
implementation.  I suggest implementing setShowsFirstResponder: in the
control.  And finally, to attempt some sort of portability, we
implement setShowsFirstResponder: in the cell to do nothing or perhaps
to call the {corresponding control}'s method.  But
setShowsFirstResponder: in the cell is to be deprecated and we should
never use it ourselves because it breaks the API and the cell/control

Well, the other thing is - some people don't want the dotted outline
never.  We need to add a user default so it can be turned totally off.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]