Sorry I put it off the list, as I wasn't sure you were fully
understand what I was talking about.
I am still not sure why you need to get into those chain of responder
when the delegation should be enough, may be we are completely talking
about different use cases.

Anyway, GNUstep isn't tracking Cocoa's behavior then assumes it as a
correct behavior. It should and only is tracking Cocoa documentations
(Which I, sometimes, think it's kinda, sometimes, stupid)

On Wed, Dec 7, 2011 at 5:37 PM, Ivan Vučica <[email protected]> wrote:
> Hi,
>
> Let's keep the conversation on the mailing list :)
>
> If GNUstep is tracking Cocoa, then this is the correct behavior. I didn't
> know about -fieldEditor:forObject: (thanks!) so I examined the first
> responder. For the sake of documentation, I'll post the code here. Again,
> it's for OS X but I suspect that it should work under GS, too.
>
> Providing a helper function that updates both the text field and the
> editor's background color might be an interesting GNUstep-specific extension
> to NSTextField class.
>
>         [contactFirstNameTextField setBackgroundColor:[NSColor redColor]];
>
>         [contactLastNameTextField setBackgroundColor:[NSColor redColor]];
>
>         [contactCompanyTextField setBackgroundColor:[NSColor redColor]];
>
>         if ([self.window.firstResponder isKindOfClass:[NSText class]])
>
>         {
>
>             NSText *textBox = (NSText*)self.window.firstResponder;
>
>             /*
>
>             for (NSResponder *parent = textBox.nextResponder; parent; parent
> = parent.nextResponder)
>
>             {
>
>                 if(parent == contactFirstNameTextField || parent ==
> contactLastNameTextField || parent == contactCompanyTextField)
>
>                 {
>
>                     if([textBox.nextResponder
> respondsToSelector:@selector(setBackgroundColor:)])
>
>                     {
>
>                         [(id)textBox.nextResponder
> setBackgroundColor:[NSColor redColor]];
>
>                     }
>
>                     break;
>
>                 }
>
>             }
>
>              */
>
>             NSTextField *parent = [textBox parentTextField];
>
>             if(parent == contactFirstNameTextField || parent ==
> contactLastNameTextField || parent == contactCompanyTextField)
>
>             {
>
>                 if([textBox.nextResponder
> respondsToSelector:@selector(setBackgroundColor:)])
>
>                 {
>
>                     [(id)textBox.nextResponder setBackgroundColor:[NSColor
> controlBackgroundColor]];
>
>                 }
>
>             }
>
>
>         }
>
>
>
> On Wed, Dec 7, 2011 at 06:11, Bluna Ratimonkey <[email protected]> wrote:
>>
>> Hi,
>> A text field didn't generate a text view but invoke NSWindow's
>> -fieldEditor:forObject: which will return a shared among many
>> controls.
>> I already have a working code, the one I posted. What I ask was if it
>> is necessary to do it that way, or if set...Color: and it should also
>> do that for me.
>> Thanks,
>> Bluna
>>
>> On Wed, Dec 7, 2011 at 8:24 AM, Ivan Vučica <[email protected]> wrote:
>> > If I remember correctly, under OS X focusing a textfield generates a
>> > textview. I don't know what happens under OS X. Try fetching your first
>> > responder and drill your way back to the top of the responder hierarchy,
>> > inspecting the responder classes along the way.
>> >
>> > If you still have issues with this, fire off another mail and I'll send
>> > some code I wrote for OS X that changes color of the text field based on
>> > validation results for the currently entered text.
>> >
>> > Poslano s mog iPad uređaja
>> >
>> > 3. 12. 2011., u 22:18, Bluna Ratimonkey <[email protected]> napisao:
>> >
>> >> Hi,
>> >> NSTextField didn't change color on set...Color: while editing, is that
>> >> a bug?
>> >>
>> >> I have to hack like this to set the color directly
>> >>
>> >> [[[myTF window] fieldEditor:NO forObject:myTF]
>> >> setBackgroundColor:color];
>> >>
>> >> Is that a correct way to hack it?
>> >>
>> >> Cheers,
>> >> Bluna
>> >>
>> >> --
>> >> /* Join Bluna Ratimonkey (漫画家) and build the real future for GNUstep !
>> >> */
>> >>    [@"http://mus3.sourceforge.net"; setNeedsYourHelps:YES!!];
>> >>
>> >> _______________________________________________
>> >> Gnustep-dev mailing list
>> >> [email protected]
>> >> https://lists.gnu.org/mailman/listinfo/gnustep-dev
>>
>>
>>
>> --
>> /* Join Bluna Ratimonkey (漫画家) and build the real future for GNUstep ! */
>>    [@"http://mus3.sourceforge.net"; setNeedsYourHelps:YES!!];
>
>
>
>
> --
> Ivan Vučica - [email protected]
>
>



-- 
/* Join Bluna Ratimonkey (漫画家) and build the real future for GNUstep ! */
   [@"http://mus3.sourceforge.net"; setNeedsYourHelps:YES!!];

_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to