discuss-gnustep
[Top][All Lists]
Advanced

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

Re: gui fixes


From: Fred Kiefer
Subject: Re: gui fixes
Date: Fri, 31 Aug 2007 13:03:58 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20060911)

Andreas Höschler wrote:
> Hi all,
> 
>>> *NSControl*
>>> The delegate of an NSControl should be able to access validated values
>>> with objectValue in -controlTextDidChange:(NSNotification *)obj (at
>>> least that's the behavior on MacOSX).
>>>
>>> - (void)textDidChange: (NSNotification *)aNotification
>>> {
>>> NSMutableDictionary *dict;
>>>
>>> // validate NSNumbers immediately so that objectValue returns reasonable
>>> values in controlTextDidChange:
>>> if ([_cell isEntryAcceptable:[[aNotification object] text]])
>>> {
>>> [self validateEditing];
>>> }
>>>
>>>
>>> ...
>>> }
>>>
>>
>> Here I would like to get some evidence that this is what Cocoa does. You
>> could for example place a break point in validateEditing and see from
>> where it gets called.
> 
> On MacOSX valdiateEditing is called from here:
> 
> #0  0x9313e878 in -[NSControl validateEditing] ()
> #1  0x931400b8 in -[NSActionCell attributedStringValue] ()
> #2  0x930bb6a8 in _NXDrawTextCell ()
> #3  0x930c8180 in -[NSTextFieldCell drawInteriorWithFrame:inView:] ()
> 
> Until this is properly figured out, I have changed the above method
> (temporary hack) as follows, since the above caused problems with date
> formatters.
> 
> - (void)textDidChange: (NSNotification *)aNotification
> {
>    NSMutableDictionary *dict;
> 
>    // validate NSNumbers immediately so that objectValue returns
> reasonable values in controlTextDidChange:
>    if ([(NSFormatter *)[_cell formatter]
> isKindOfClass:[NSNumberFormatter class]])
>      {
>       [self validateEditing];
>      }
> 
>     ...
> }
> 

Sorry, I am not sure, if I understand this. You surely found a problem
in GNUstep, as we don't call validateEditing for the
attributedStringValue method of NSActionCell. This is easy to add, still
you insist on your completely different change, so you must have a
reason for that. Also up to now you didn't complain about a problem in
the drawing code, where your traceback comes from. You should give your
breakpoint another try, validateEditing is surely called more often and
you are looking for another case.

I am off now heading for the AlpenStep meeting.

Fred





reply via email to

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