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.

Ironically, I had to solve this problem yesterday and didn't notice this question previously until others replied today. My solution was a very simple subclass of NSTextField:

@interface NSTextFieldClickable : NSTextField {
}

@end

@implementation NSTextFieldClickable

- (void)mouseDown:(NSEvent *)theEvent;
{
        [self sendAction:[self action] to:[self delegate]];
}

@end

That's all. It's not perfect in that it doesn't handle tracking etc, but for a URL in an about box, it's probably adequate. Alternatively, it would be possible to add tracking as desired to this solution (if anyway does that, I'd love a copy).

In my research, most references to clickable NSTextFields required the field to be editable which is not the case for an about box URL label.

Enjoy,
   Peter.

--
              Keyboard Maestro 3 Now Available!
                Now With Status Menu triggers!

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.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 [EMAIL PROTECTED]

Reply via email to