Good options for clickable download link or button in table cell?

24 views
Skip to first unread message

Luke

unread,
Apr 16, 2024, 1:26:51 AMApr 16
to Cappuccino & Objective-J
I'm trying to figure out a good way to code a download link or button in a table cell.

In Cocoa there's NSLinkAttributeName that could probably work, but I don't think we have that option in Cappuccino.
Maybe I could just make the entire cell clickable anyway.

I considered just making my single 'status' cell into a CPButton if and only if the row it was in had a downloadable item.  I thought maybe I could use
 -tableView:viewForTableColumn:row: 
by responding with nil for the vast majority of cells, except for the few that had the downloadable content, and returning a CPButton for those only. 
However, returning nil appears not to work. 
It I return a CPTextField in all the other cases, then I lose the standard formatting that table cells have that is set on every other cell in my application, which is a bit annoying... although maybe there's a way to pick up the 'default cell view' somehow. 

Anyway, mostly curious as to what people have done to code something like this. 
Naturally I'd like something that's as simple as possible.   I have browsed the tests and demos and nothing has jumped out at me (though it's entirely possible that I've missed something!). 


 

Keary Suska

unread,
Apr 16, 2024, 1:03:44 PMApr 16
to objec...@googlegroups.com
I would just have a default cell view with the download button and toggle the hidden attribute conditionally in -tableView:viewForTableColumn:row:. As long as you are properly calling -makeViewWithIdentifier:owner:, this should work well.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business”
> --
> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to objectivej+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/objectivej/e60ddad3-ad1c-4a46-afdd-d853a4abe700n%40googlegroups.com.

Daniel Böhringer

unread,
Apr 16, 2024, 1:45:25 PMApr 16
to objec...@googlegroups.com
you could set the prototype cell (CPTableColumn's setDataView:) to a subclass that displays / hides the link as needed

Luke

unread,
Apr 16, 2024, 3:01:19 PMApr 16
to Cappuccino & Objective-J
Thank you both.

Is there a simple way to have a custom cell view pick up the same settings/styles as the default cell view?


Reply all
Reply to author
Forward
0 new messages