🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #682

Re: Problem ending a cell edit in a Matrix

#682
From: Charles Herrick
Date: Tue, 14 Apr 1992 16:21
53 lines
2427 bytes
In article <12304@tamsun.tamu.edu> d1h1883@himalia.tamu.edu.tamu.edu  
(Dave Hess) writes:
$ I've got a matrix full of TextFieldCells with some of them
$ editable/selectable and some of them not. When I go to reload the
$ Matrix with new values I get a redraw problem in the cell that is
$ currently being edited. All the other cells get redrawn fine, just  
the
$ one being edited is munged. I finally realized that I probably need  
to
$ end the editing before I update. I've tried selecting the cell at
$ (-1,-1) as suggested in the documentation but it produces no  
change.
$ The same cell is still being edited.
$ 
$ The Matrix is in track mode and I do have the cell background gray
$ set.  I've also tried setting the Matrix to allow an empty  
selection
$ which is only supposed to apply for radio mode with no luck. 

don't know if this helps or not, but regarding an end of edit, I  
found this in Window.rtf:

BEGIN--CUT HERE--
endEditingFor:
- endEditingFor:anObject

Makes the Window's field editor (a Text object) available for a new  
editing assignment by detaching it from the object it's currently  
serving (normally its superview and delegate).  If the field editor  
is the first responder, the Window is made the new first responder.   
This forces a textDidEnd:endChar: message to be sent to the field  
editor's delegate.  The field editor then is assigned a nil delegate  
and is removed from the view hierarchy (its superview is made nil).   
This forces an end to editing even if the field editor had refused to  
resign its status as the first responder.

To conditionally end editing, first try to make the Window the first  
responder:

if ( [myWindow makeFirstResponder:myWindow ] ) {
    [myWindow endEditingFor:nil];
    . . .
}

makeFirstResponder: returns nil if the current first responder won't  
resign.  This is the preferred way to verify all fields when an OK  
button is pressed in a panel, for example.

Returns self.

See also:  - getFieldEditor:for:

END--CUT HERE--
Technical Details
Message-ID: <12382@tamsun.tamu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!news.utdallas.edu!tamsun!maraba.tamu.edu
References: <12304@tamsun.tamu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!news.utdallas.edu!tamsun!maraba.tamu.edu
From: cnh5730@maraba.tamu.edu (Charles Herrick)
Newsgroups: comp.sys.next.programmer
Subject: Re: Problem ending a cell edit in a Matrix
Message-ID: <12382@tamsun.tamu.edu>
Date: 14 Apr 92 16:21:53 GMT
References: <12304@tamsun.tamu.edu>
Sender: usenet@tamsun.tamu.edu
Lines: 53