Thanks I will give this a try!
Post not yet marked as solved
I installed 13.2.1 but still don't see any packages in the GitHub source.
Post not yet marked as solved
Thanks, for your answer.. I have decided to save the image to a file.
Thanks Claude for sending me the additional examples. Very useful!
The following is the correct answer. It was supplied by Claude31 as well as an offline template he sent me.
The way I do it is to design the report as a view in code.
Schematically, it will be:
I create a PrintView and house all the drawing in the draw function
class PrintView: NSView {
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect) // Drawing code here. }}
Then, to print, I call (from the handler of Print menu command for instance or from a print button in a view)
let aSize = NSSize(width: printInfo.paperSize.width - 20, height: totalHeight)
let printView = PrintView(frame: NSRect(origin: NSPoint(x: 1, y: 10), size: aSize)) // a full page, depending on orientation
and call the printPanel
let printOp = NSPrintOperation(view: printView, printInfo: printInfo)
Claude,
Makes sense what you posted, I was hoping there was a design tool to create the drawing code.
So, does that mean thinks like Font, Font Size, colors, Graphics etc. are created in PrintView Class with code? And I guess the only way to see the report is to print it?
Do you have any code of a PrintView class you could share?
Thanks
Thanks Claude.. I got it working like I want using what I suggested above. Very similar to what you had suggested.
I found the problem, It was in the IB... there was not a connection from the column textField to the table view cell.
I know how I am going to proceed. I will build an array that I will update from the ComboAction and then use this array for the tableView as opposed to try to update the tableView cells directly.
Thanks Claude, I used the @IBAction because I needed the contents of the comboBox and I had tried the delegate before and could not see a way to get contents of comboBox.
Thanks to Claude for getting this working..
I get an error when I added the following statement
NSComboBoxCell.delegate = self
The error was no delegate member for NSComboBoxCell..
So, I created a new test project which had a single view and a tableView that I added a comboBox to one of the columns without trying to use a datasource, I expected to see Item 1, Item 2 .. etc. in the column, but again nothing. Also, the comboBox is editable.
There must be something basic I am missing. Still looking for an example..
I changed func numberOfItemsInComboBoxCell(in comboBoxCell: NSComboBoxCell) - Int {
to
func numberOfItems(in comboBoxCell: NSComboBoxCell) - Int {
and the error went away, however it still does not work. Also, I put a breakpoint on the function " func comboBoxCell" and it does not get called.
Any Ideas how to resolve?
It turns out if I use a NSTextView object instead of NSTextField object the spelling and grammar are built in. So, all I had do to was the following:
create a scrollable text view object and then connect the TextView as follows:
@IBOutlet var itemDescription: NSTextView!
Then turn on continuous spell checking with
itemDescription.isContinuousSpellCheckingEnabled = true
Thanks Claude,
The WWDC video had some other items of interest as well as NSTextCheckingController, however as you said "light overview" but somewhat helpful.
I think I will take you suggestion and talk with apple support as I am mainly interested in NSTextCheckingController since it is the newer API.