Re: How to blink with a focus ring of the text box?

2011-10-07 Thread Nick
Thank you for responses!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Yi Lin
Another way is to make the cursor stop at the end of the limit, and if the
user keeps banging on the keyboard, show an alert message stating the
character limit on the field.

On Thu, Oct 6, 2011 at 8:33 AM, Nick  wrote:

> Hello
> I am wondering if there's a way to do this, notifying the user that he
> can't
> enter any more text into NSTextField edit box?
> Is there a way to change the color of the NSTextField's focus ring to red
> (to highlight that this is an error)?
> How difficult would that be to implement?
> Thank you!
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/yioncocoa%40gmail.com
>
> This email sent to yionco...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Quincey Morris
On Oct 6, 2011, at 08:33 , Nick wrote:

> Is there a way to change the color of the NSTextField's focus ring to red
> (to highlight that this is an error)?


I think this sounds like a *terrible* idea. Not because it's a terrible idea, 
but because introducing yet another subtle[-ish] sound/flash/color behavior 
whose meaning isn't obvious into the UI is a terrible idea.

Apart from the problem of foisting yet another arbitrary UI convention on the 
user, the use of color alone to indicate status is not a great idea, and the 
use of red to signal an error is culturally specific and so possible 
off-putting in some parts of the world (though the boat may have already sailed 
on that last issue).

I think the 'NSImageNameInvalidDataFreestandingTemplate' solution, associated 
with label text that explains why the icon is there, is an excellent way to 
show the error, without introducing any new UI behaviors.

> I am wondering if there's a way to do this, notifying the user that he can't
> enter any more text into NSTextField edit box?

I think you're making a mistake in assuming it's a good idea to prevent the 
user from entering the excess text. In many scenarios, it's probably better to 
go ahead and let the user enter any amount of text, and complain afterwards. 
You can show an error condition as described above, or (if, say, your window 
doesn't have room for the entire error description), you can put up an alert 
sheet (when enter is pressed) that says what's wrong and what the limits are.

OTOH, if this is something where the user is very aware of the length 
limitation (for example, the 4-digit passcode used to unlock an iPhone), I'd be 
inclined to just reject the excess text and beep (perhaps with a temporary 
error status message if there's room for it in the UI, perhaps changing the 
color of something in the UI, though not necessarily the text field). 

FWIW.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Lee Ann Rucker

On Oct 6, 2011, at 9:12 AM, Scott Ribe wrote:

> On Oct 6, 2011, at 9:54 AM, Gary L. Wade wrote:
> 
>> I'm guessing you're wanting this for invalid characters as well as exceeded 
>> number of characters? It sounds like an intriguing extension to the UI. It 
>> might be easier to flash a red translucent overlay on the field contents 
>> instead.
> 
> Or some little red arrow icon next to it, as on some web sites. 

NSImageNameInvalidDataFreestandingTemplate, with red applied to it. Has the 
advantage of not relying entirely on color to distinguish it; changing the blue 
focus ring to another color may not be something all users can detect.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Scott Ribe
On Oct 6, 2011, at 9:54 AM, Gary L. Wade wrote:

> I'm guessing you're wanting this for invalid characters as well as exceeded 
> number of characters? It sounds like an intriguing extension to the UI. It 
> might be easier to flash a red translucent overlay on the field contents 
> instead.

Or some little red arrow icon next to it, as on some web sites. Or if on Lion, 
a popover attached to the text field with an explanation of the error. Or a 
small label underneath showing a count of remaining characters, that turns red 
once the length goes over. 

The last one is something that I've actually used. I like it because it allows 
the user to enter what he's thinking without interruption, then edit it until 
it fits. "Banging into the end" and not being able to enter more, going back 
and deleting a few characters, then going to the end and typing a few more, and 
repeating until you figure out an abbreviated form that fits is much more 
tedious.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Kyle Sluder
On Oct 6, 2011, at 8:54 AM, "Gary L. Wade"  wrote:

> I'm guessing you're wanting this for invalid characters as well as exceeded 
> number of characters? It sounds like an intriguing extension to the UI. It 
> might be easier to flash a red translucent overlay on the field contents 
> instead.

I don't know about the red overlay, but I agree that it's a very intriguing 
extension to the UI.

As suggested, you could use a custom formatter to reject strings over a certain 
length. That will do the expected thing and play the bonk! sound effect when 
the user tries to enter too much text.

But you should definitely file a radar asking for that flash behavior. That 
sounds like a promising line of investigation. Plus we could really stand to 
get access to the focus ring.

--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Adding to my own post I just found this in my snippets collection:

This listing shows how you draw such a focus ring. It requires you to override 
the NSCell drawWithFrame:inView: In this method, if the cell is supposed to 
draw evidence of first-responder status, set the rectangle for the focus ring, 
call NSSetFocusRingStyle with an argument of NSFocusRingOnly, and then create 
and fill a bezier path defining that rectangle. Filling in this case simply 
draws the ring.

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
{
// other stuff might happen here
if ([self showsFirstResponder]) {
 // showsFirstResponder is set for us by the NSControl that is drawing  
us.
NSRect focusRingFrame = cellFrame;
focusRingFrame.size.height -= 2.0f;
[NSGraphicsContextsaveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame, 4.0f, 
4.0f)] fill];
[NSGraphicsContext restoreGraphicsState];
}
// other stuff might happen here
}

So possibly you could create your own NSTextFieldCell, set your NSTextField to 
use it, call [super drawWithFrame.] somewhere in the above method to do the 
standard drawing and move on from there. The flashing could be implemented 
using a CALayer animation or something.

If you manage to implement this you should make it open source :-) since I 
guess it's quite a bit of work to get it done.

> Read carefully:
> 
> The original poster stated: "any more text" - or are you suggesting that he 
> should disable the text box when a certain number of characters are reached? 
> I guess not.
> 
> AFAIK, the focus ring is not accessible programmatically, except form setting 
> it by making something the first responder.
> 
> You could use a text formatter or one of the validation methods and simply 
> stop accepting key strokes, change the text color to red and/or display an 
> alert.
> 
> Am 06.10.2011 um 17:43 schrieb Thomas Davie:
> 
>> The correct way to notify a user that he can't enter text in a text box is 
>> to disabled it.
>> 
>> Bob
>> if (*ra4 != 0xffc78948) { return false; }
>> 
>> On 6 Oct 2011, at 16:33, Nick wrote:
>> 
>>> Hello
>>> I am wondering if there's a way to do this, notifying the user that he can't
>>> enter any more text into NSTextField edit box?
>>> Is there a way to change the color of the NSTextField's focus ring to red
>>> (to highlight that this is an error)?
>>> How difficult would that be to implement?
>>> Thank you!
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
>>> 
>>> This email sent to tom.da...@gmail.com
>> 
> ___

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Gary L. Wade
I'm guessing you're wanting this for invalid characters as well as exceeded 
number of characters? It sounds like an intriguing extension to the UI. It 
might be easier to flash a red translucent overlay on the field contents 
instead.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

On Oct 6, 2011, at 8:33 AM, Nick  wrote:

> Hello
> I am wondering if there's a way to do this, notifying the user that he can't
> enter any more text into NSTextField edit box?
> Is there a way to change the color of the NSTextField's focus ring to red
> (to highlight that this is an error)?
> How difficult would that be to implement?
> Thank you!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Read carefully:

The original poster stated: "any more text" - or are you suggesting that he 
should disable the text box when a certain number of characters are reached? I 
guess not.

AFAIK, the focus ring is not accessible programmatically, except form setting 
it by making something the first responder.

You could use a text formatter or one of the validation methods and simply stop 
accepting key strokes, change the text color to red and/or display an alert.

Am 06.10.2011 um 17:43 schrieb Thomas Davie:

> The correct way to notify a user that he can't enter text in a text box is to 
> disabled it.
> 
> Bob
> if (*ra4 != 0xffc78948) { return false; }
> 
> On 6 Oct 2011, at 16:33, Nick wrote:
> 
>> Hello
>> I am wondering if there's a way to do this, notifying the user that he can't
>> enter any more text into NSTextField edit box?
>> Is there a way to change the color of the NSTextField's focus ring to red
>> (to highlight that this is an error)?
>> How difficult would that be to implement?
>> Thank you!
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
>> 
>> This email sent to tom.da...@gmail.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Thomas Davie
The correct way to notify a user that he can't enter text in a text box is to 
disabled it.

Bob
if (*ra4 != 0xffc78948) { return false; }

On 6 Oct 2011, at 16:33, Nick wrote:

> Hello
> I am wondering if there's a way to do this, notifying the user that he can't
> enter any more text into NSTextField edit box?
> Is there a way to change the color of the NSTextField's focus ring to red
> (to highlight that this is an error)?
> How difficult would that be to implement?
> Thank you!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
> 
> This email sent to tom.da...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to blink with a focus ring of the text box?

2011-10-06 Thread Nick
Hello
I am wondering if there's a way to do this, notifying the user that he can't
enter any more text into NSTextField edit box?
Is there a way to change the color of the NSTextField's focus ring to red
(to highlight that this is an error)?
How difficult would that be to implement?
Thank you!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com