||Thread Tools||Search this Thread||Display Modes|
|Oct 22, 2012, 10:49 PM||#1|
Need to click once on hyperlink before it activates?
I have a panel with a hyperlink on it. I used some code from Technical Q&A1487 (Embedding Hyperlinks in NSTextField and NSTextView), and to get the hand cursor, I tried both a small subclass of NSTextView, implementing resetCursorRects, and the DSClickableURLText class. In both cases, when my panel comes up, I have to click once on the hyperlink before I see the hand cursor and can go to the URL. I call selectText: self (in fact, I have to, or I can't ever get to the URL). I've also tried calling makeFirstResponder on the window. But I still have to click on it once before it works.
Is this just an anomaly in the OS or the kit? Is there a way I can get this to work programmatically, but simulating a click?
|Oct 23, 2012, 02:36 PM||#2|
I did see this post:
You need to use an NSTextView here rather than an NSTextField. The
behavior you are seeing is because an NSTextField is not 'active'
until clicked upon, and then it gets the window's field editor (which
is a shared NSTextView used by all fields on the window), and places
that view on top of the text field and uses it to edit the text. It is
NSTextView that handles the link hand cursor, and et cetera.
Isn't there any way around this? Without the NSTextField subclass code, even though the font changes, at least it goes to the hyperlink on the first click. I tried using an NSTextView, and it wasn't working.
|Oct 23, 2012, 07:10 PM||#3|
Looks like this would do it:
[[myText currentEditor] setSelectedRange:NSMakeRange(0, 0)];
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Phone acting strange, activates itself help||chestvrg||iPhone||3||Nov 25, 2013 08:49 PM|
|How to remove a hyperlink with the right click||Sudzia||Mac Basics and Help||0||Nov 1, 2013 06:12 AM|
|Hyperlink||shooter28||iPhone Tips, Help and Troubleshooting||1||Jun 24, 2013 02:07 PM|
|AT&T Activates LTE in Philly - Just in time for iPhone 5!||Hitch08||iPhone||33||Sep 23, 2012 08:30 AM|
|Hyperlink App||jones8865||iPad Apps||0||Jul 16, 2012 01:47 AM|
All times are GMT -5. The time now is 06:00 PM.