discuss-gnustep
[Top][All Lists]
Advanced

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

Re: [Gnustep-cvs] r29010 - in /libs/gui/trunk: ChangeLog Headers/AppKit/


From: Fred Kiefer
Subject: Re: [Gnustep-cvs] r29010 - in /libs/gui/trunk: ChangeLog Headers/AppKit/NSCell.h Source/NSActionCell.m Source/NSCell.m
Date: Mon, 16 Nov 2009 12:39:33 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Wolfgang Lux schrieb:
> Fred Kiefer wrote:
> 
>> Wolfgang Lux schrieb:
>>> Author: wlux
>>> Date: Sat Nov 14 23:15:31 2009
>>> New Revision: 29010
>>>
>>> URL: http://svn.gna.org/viewcvs/gnustep?rev=29010&view=rev
>>> Log:
>>> Fix NSActionCell implementation so that -setObjectValue: and
>>> -setStringValue: have an effect while the cell is edited.
>>>
>>> Modified:
>>>     libs/gui/trunk/ChangeLog
>>>     libs/gui/trunk/Headers/AppKit/NSCell.h
>>>     libs/gui/trunk/Source/NSActionCell.m
>>>     libs/gui/trunk/Source/NSCell.m
>>
>> I have a problem with this change. With this the NSForm test in GSTest
>> now starts to flicker when editing a form cell. It works fine for the
>> first cell on the window, which doesn't belong to a form.
> 
> Chapeau! I had to look twice before I noticed the flicker.

Oh, it is quite noticable on my computer. Don't know if this means it is
too slow or to fast :-(

>> Could you please explain the motivation of this change and perhaps
>> together we may come up with a better way to achieve the same goal.
> 
> The problem I attempted to fix is that [cell setStringValue:...] did
> not have an effect while the cell is edited. The argument of the
> message is saved to the respective cell attributes, but the field
> editor was not updated.
> 
> Now for the screen flicker in NSFormCell. The problem is that for some
> reason I do not understand, the NSForm repeatedly redraws the edited
> form cell while it is active. While the cell is redrawn it calls the
> cell's -attributedStringValue method to read the string to be drawn in
> the cell. This method now calls -validateEditing on its control view,
> which in turn writes back the string to the cell with -setStringValue:
> (I've attached a backtrace at the bottom of this mail). This had no
> observable effect up to now, but now causes the screen flicker as
> -setStringValue: updates the field editor.
> 
> Now I think that NSForm should not draw the contents of the edited cell
> in the first place; this should be the business of the field editor.
> Incidentally, I have seen a similar effect for an NSTextField as I had
> commented out the following code in NSControl's -drawRect: method.
> 
>   if ([self currentEditor] != nil)
>     {
>       [_cell setControlView: self];
>       return;
>     }

This code helps to stop redisplay while the cell is edited. We have
similar code in NSTableView to prevent the edited cell from being
redisplayed. The problem with NSForm is that we cannot solve the problem
that easily. If we don't draw the edited cell in NSMatrix, the super
class of NSForm, then we will also miss to redisplay the title of the
cell (as well as any border, but this is also the case in the other places).

The other way to intervene here is to check whether the values we set
actually changed and only pass on real changes to the editor. The
problem with this is that I don't see a simple way to decide, whether
the value changed.
What I did, so to introduce another hack. We now only mark the cell as
needing a redraw, when there is no editor for it. This looks OK on my
computer, but could have other side effects we need to look out for.

Cheers
Fred





reply via email to

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