Example of TableView needed #214
Replies: 6 comments 2 replies
-
Go: 1.21.1 |
Beta Was this translation helpful? Give feedback.
-
Yea weird. I got it working though. First, you need to set the headerview of the tableview: tableView.SetHeaderView(appkit.NewTableHeaderViewWithFrame(rectOf(0, 0, 0, 20))) I originally tried with a zero frame but 20 height is what made it work. Second, you have to wrap the tableview in a scrollview, I guess since the headers don't scroll they're rendered by the scrollview? I tried without a scrollview and it didn't work. Something like: tsv := appkit.NewScrollView()
tsv.SetFrame(rectOf(0, 0, 400, 300))
tsv.SetDocumentView(tableView)
tsv.SetHasHorizontalScroller(true)
tsv.SetAutohidesScrollers(true)
tsv.SetTranslatesAutoresizingMaskIntoConstraints(true)
cv.AddSubview(tsv) |
Beta Was this translation helpful? Give feedback.
-
Since this one is tricky, it would be nice if you added a standalone tableview example! |
Beta Was this translation helpful? Give feedback.
-
OK. Will do. I'll try this all when I'm back on the Mac. |
Beta Was this translation helpful? Give feedback.
-
OK, I've made some good progress on an example I want to send upstream: https://github.com/corruptmemory/macdriver/tree/jim/tableview/macos/_examples/tableview
But I'm either doing something wrong, or there is something else to look at. If you quit the program with CMD-Q, the program always seems to cleanly exit. Clearly, this is what I want 😁 . However, if you close the window, I reliably get a "combined" CGO+Go stack trace. An abridged example:
Clearly, there is some race condition going on here, but I'm having trouble diagnosing exactly what it is. Roughly speaking, it looks like the Objective-C and Go runtimes are shutting down in an incompatible manner. Thoughts? Another quick question: Is there a way to programmatically set the name of the "Application menu?" In my example, it's coming up with |
Beta Was this translation helpful? Give feedback.
-
OK, I think I sorted everything out. It appears that In any case, here's an MR: #217 |
Beta Was this translation helpful? Give feedback.
-
I've tried my best to get a TableView to work. The code is here: https://github.com/corruptmemory/macdriver/blob/jim/tableview/macos/_examples/widgets/main.go
It's based on the existing
widgets
example. I can actually get the TableView to display data, but I have failed at every attempt to get the table headers to appear. If I explicitly get the View for the headers, I can forcibly display the headers "somewhere" in the TableView, but not where it's supposed to be.Beta Was this translation helpful? Give feedback.
All reactions