I have a program that has a NSTableView populated with files to be uploaded. Once the file is sent, the Text Cell with the file's name gets a hyperlink placed into it (the array data is given an NSMutableString with an NSLinkAttributeName attribute). How do I allow users to click this link to open the webpage in their default browser?
Create and Respond to a Hyperlink within a NSTableView Text Cell
398 Views Asked by P.M. At
2
There are 2 best solutions below
Related Questions in OBJECTIVE-C
- How to control the volume of an iPhone programmatically in objective-c
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- How to set value the descriptor of iOS BLE in Objective-C?
- Unexpected #selector() Behavior in Swift-Objective-C Interop?
- In what context can we use an unqualified #selector() expression in Swift?
- AVPictureInPictureController crashes during initialization
- How to use pow() in Objective-C?
- How to change the image on the MGSwipeButton in MGSwipeTableCell
- Using sort descriptors in Outline View
- Why is my Swift function not printing from inside the dataTask closure?
- Using UICollectionViewCell with IBOutlet
- Undefined symbol: _OBJC_CLASS_$_ only on simulator
- Why can't I receive a notification sent from Camera Extension(Swift) to an observer application (obj-c++)
- Behavior of __block modifier in objc
- Inserting subview into view where I've added subviews and sublayers
Related Questions in MACOS
- Error installing Nativescript on Mac M2 Sonoma 14.4.1
- macOS - Most secure way of a GUI SUDO_ASKPASS
- When using onDrag in SwiftUI on Mac how can I detect when the dragged object has been released anywhere?
- Why does Hugo generate different taxonomy-related HTML on different OS's?
- ZSH function parameters conundrum
- how to make read only file/directory in Mac writable
- macOS BigSur - Unable to run bundled php version or brew php 8
- 9 Digit Addresses in Hexadecimal System in MacOS
- MacOS Bash-Script: while read p and echo
- How to make a range for tail rows on a categorized table in Numbers with JXA scripts?
- Cannot build a basic project with curl on Mac (M2) for Raspberry Pi Pico
- How to recover deleted files from create vite react project
- Can't run built SFML project from Xcode template
- React Native - RealmJS - Linker command failed with exit code 1
- How can I manually add a keyboard shortcut to a Shortcut Action Service directly via the system files, without going through the System Prefs GUI?
Related Questions in SWIFT
- Navigate after logged in with webservice
- URLSession requesting JSON array from server not working
- When using onDrag in SwiftUI on Mac how can I detect when the dragged object has been released anywhere?
- Protect OpenAI key using Firebase function
- How to correct error: "Cannot convert value of type 'MyType.Type' to expected argument type 'Binding<MyType>'"?
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Using @Bindable with a Observable type in SwiftUI
- How to make a scroll view of 9 images in a forEach loop open on image 6 if image 6 is clicked on from a grid?
- Using MTLPixelFormat.rgba16Float results in random round-off errors
- Search and highlight text of current text in PDFKit Swift
- How is passing a function as a parameter related to escaping autoclosure?
- Actionable notification api call not working in background
- Custom layout occupies all horizontal space
- Is it possible to fix slow CKAsset loading on Cloudkit?
- Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value - MapView.isMyLocationEnabled
Related Questions in NSTABLEVIEW
- How to create a table cell view like this similar to native not app notification view
- NSTableView to NSOutlineView Drag & Drop not accepting drop
- How to remove horizontal line in bottom of section NSTableView?
- Identify modified row for NSTableView bound with NSArrayController
- NSTableView.reloadData(forRowIndexes:columnIndexes:) causes wrong subview layout when usesAutomaticRowHeights = true
- Calculate/Display NSTableView column sum
- NSTableView is unresponsive when presented in NSApp.runModal(for:)
- NSTableView hangs when scrolled down in fullscreen mode
- NSTableView cell value may remain with invalid value after validateValue(_:forKey:) failed. How to prevent this?
- How do I vertically align text in a custom table
- Unable to remove left & right borders on NSTableview in an NSScrollView
- NSTableView multi-column drag reorder rows and include all columns
- Using Swift, how can I get the x-coordinate of an NSTableColumn while it is being dragged
- How can I update the datasource presented in a programmatically created NSTableView
- NSTableView does not show last column
Related Questions in NSCELL
- How to get a cell's frame in hitTestForEvent method in the NSBrowserCell subclass?
- Creating NSAttributedString on background queue: "[NSCell init] must be used from main thread only"
- How to draw NSPopupButtonCell highlighted image
- How to detect active appearance for NSView or for its parent NSWindow?
- How to not truncate text in NSCellTextView Swift 5
- Setting Multiline Title To NSButton In Cocoa App
- How to allow Paste (cmd+v) into NSTableView cell?
- How to make outlineView:objectValueForTableColumn:.. accept an attributedString
- Hiding the lupe icon of a NSSearchField
- Tracking the position of a NSCell on change
- Scrolling is slow with Cell based NSTableView
- Unable to change NSTableHeaderCell font on El Capitan
- NSTextFieldCell's cellSizeForBounds: doesn't match wrapping behavior?
- NSComboBoxCell eats mouseUp events
- Custom NSControl
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
After much searching and trying multiple methods, this is what I came up with as a solution.
Creating a custom class that extends NSTableViewCell:
Checking first responder status when the NSTableView selection changes. This is necessary because the table's selection can be changed, even when it is not the firstResponder:
Adding KVO for checking when FirstResponder changes:
Finally, checking if the main window (the app itself) is in focus (if this is not done, then the colors won't change appropriately when the window loses focus):