I’m trying to display a hyperlink in a text field.
I got it working, and i get i handcursor when i select a piece of text. But my problem is that I don’t get the handcursor when rolling the mouse over the text field.
I solved it. If anyone want’s to know, here’s how.
First download DSClickableURLTextField and add that to your project by right-clicking on “Other Sources” and “Add → Existing Files”.
Add the following in DSClickableURLTextField.m:
Open IB and drag a normal text field from the Library palette to your window. Highlight the text field, open Inspector and go the the Identity view. At the top under "Class Identity change class from NSTextField to DSClickableURLTextField. Then under the AppleScript view check “awake from nib” and enter a name (In this example i named it “hyperlink”).
Back in Xcode add the following under the on awake from nib handler:
if name of theObject is "hyperlink" then
call method "setStringValue:andURL:" of theObject with parameters {"Go to macscripter.net", "http://www.macscripter.net"}
return
end if
Sorry to dig this 2 months old topic but, can I change the alignment of the text? In this case moving the text to the right size of the text field instead of the standard left?
I don’t understand obj-c but I can tweak it a little (sometimes) that’s all… Here’s what I went for, it changes the text colour, text size & removes the underlining…