• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextField and clickable links
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField and clickable links


  • Subject: Re: NSTextField and clickable links
  • From: Vijay Kanse <email@hidden>
  • Date: Tue, 31 Mar 2009 21:29:26 +0530

Thanks For your reply,

I got it work now following thread :

http://forums.macrumors.com/showthread.php?t=677713

Thanks.



On Tue, Mar 31, 2009 at 9:02 PM, Brandon Walkin <email@hidden> wrote:

> http://developer.apple.com/qa/qa2006/qa1487.html
>
> It has to be selectable and allow editing text attributes.
>
> On 31-Mar-09, at 9:15 AM, Vijay Kanse wrote:
>
> Hello List,
>
> I have successfully set Url to text field with attributed strings. I am not
> able to get hand cursor on textfield.
> I am using this code for clickable link.
>    [thetextfield setAllowsEditingTextAttributes:YES];
>    NSMutableAttributedString *attrstr = [[NSMutableAttributedString alloc]
> initWithString:[thetextfield stringValue]];
>    NSRange selectedRange = { 0, [[thetextfield stringValue] length] };
>
>    [attrstr beginEditing];
>
>    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
>    [dictionary setValue:[NSNumber numberWithInt:NSSingleUnderlineStyle]
> forKey:NSUnderlineStyleAttributeName];
>    [dictionary setValue:theurl forKey:NSLinkAttributeName];
>    [dictionary setValue:[NSColor colorWithCalibratedRed:0.1 green: 0.1
> blue:1.0 alpha:1.0] forKey:NSForegroundColorAttributeName];
>    [dictionary setValue:[NSCursor pointingHandCursor]
> forKey:NSCursorAttributeName];
>
>    [attrstr addAttributes:dictionary range:selectedRange];
>
>    [attrstr endEditing];
>
>    [thetextfield setAttributedStringValue:attrstr];
>
> I am getting all things o.k.
> but i am not able to see hand icon on application start on textfield.
> I tried to add a cursor on text field.
>
> [thetextfield addCursorRect:[thetextfield bounds] cursor:[NSCursor
> pointingHandCursor]];
>
> i write this methods in awakeFromNib.
>
> can any one tell me what is the problem with displaying Pointing Hand
> Cursor
> ?
> am i missing to set any property for text field.
>
> text field displays hand cursor once i clicked on it and it changes its
> fonts also.
>
>
> any help will be appreciated.
>
>
> Thanks.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >NSTextField and clickable links (From: Vijay Kanse <email@hidden>)
 >Re: NSTextField and clickable links (From: Brandon Walkin <email@hidden>)

  • Prev by Date: Re: NSTextField and clickable links
  • Next by Date: Re: Need help for user interface in COCOA + Objective C
  • Previous by thread: Re: NSTextField and clickable links
  • Next by thread: Need help for user interface in COCOA + Objective C
  • Index(es):
    • Date
    • Thread