Re: How can I use NSTextField like a button?
Re: How can I use NSTextField like a button?
- Subject: Re: How can I use NSTextField like a button?
- From: Ron Fleckner <email@hidden>
- Date: Thu, 6 Nov 2008 21:48:54 +1100
On 06/11/2008, at 8:32 PM, Ulf Dunkel wrote:
I want to use some kind of URL text in a dialog, which the users can
click on and which should then open the browser with a specific URL.
Here is an example of how it should look like:
http://man.icalamus.net/fr/img/menu/about_unregistered.gif
I used an NSTextField with blue text and connected it to my action,
as usual. But I didn't manage to receive mouse clicks from the text
field, whatever settings I changed in IB.
So I tried an NSButton instead, but it seems as if NSButton cannot
use e.g. blue text color. So I kept the NSTextField with blue text
and put a transparent NSButton without any text as an overlay over
the text area and connected the NSButton to an IBAction accordingly.
This works for me, but is this really the best way to do?
Any hints are welcome. :-)
-UlfDunkel
Hello Ulf,
Do you mean a text hyperlink, like in a web page? That's not too
hard. You don't need a button, just have to create the hyperlink.
There is a Tech Note about it. Haven't got a link handy, but you
should be able to find it on Apple's dev site searching for Q&A QA1487
"Embedding Hyperlinks in NSTextField and NSTextView".
You'll also need to -resetCursorRects for the view which holds the
hyperlink to ensure you get the pointing hand cursor.
HTH,
Ron
_______________________________________________
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