[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gui fixes
From: |
Fred Kiefer |
Subject: |
Re: gui fixes |
Date: |
Tue, 04 Sep 2007 15:09:30 +0200 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20060911) |
Andreas Höschler wrote:
> Hi all,
>
>>>> 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.
>
> I removed the above hack and instead implemented the following in NSCell.
>
> - (NSAttributedString*) attributedStringValue
> {
> if (_formatter != nil)
> {
> NSDictionary *attributes;
> NSAttributedString *attrStr;
>
> + SEL sel = @selector(validateEditing);
> + if ([[self controlView] respondsToSelector:sel]) [[self
> controlView] performSelector:sel];
>
> attributes = [self _nonAutoreleasedTypingAttributes];
> attrStr = [_formatter attributedStringForObjectValue: _object_value
> withDefaultAttributes: attributes];
> ...
> }
>
> - (id)objectValue
> {
> + SEL sel = @selector(validateEditing);
> + if ([[self controlView] respondsToSelector:sel]) [[self controlView]
> performSelector:sel];
> if (_cell.has_valid_object_value)
> {
> return _object_value;
> }
> else
> {
> return nil;
> }
> }
>
> This solves the problem as well and is probably less hackish. Any
> objections?
>
> Regards,
>
> Andreas
>
Fixed in a similar way in SVN.
- Re: gui fixes,
Fred Kiefer <=