Post

Replies

Boosts

Views

Activity

Reply to Interface Builder Basics
Thanks for the quick answer, sorry to be such a newbie but I am just getting started and there is not a lot of tutorials for macOS development.So, I have a follow up question on the colors? Where does that code go? Do I have to create a new class for it? Also, in the future in creating threads I will keep it to one question..Thanks again.
Jun ’20
Reply to Interface Builder Basics
I put the code in to add an image for the toolbar and I get the unresolved identifier 'statusitem"? Also, I don't see how this code identifies the toolbar item to change.func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application //initialize menu bar icon statusItem = NSStatusBar.system.statusItem(withLength: CGFloat(48)) let image = NSImage(named:"MyImage")! // Select image in xcAssets image.isTemplate = true statusItem.button?.image = image statusItem.button?.appearsDisabled = false statusItem.button?.action = #selector(hideAllFromStatusMenu) statusItem.button?.target = self }
Jun ’20
Reply to Changing View Colors
The present code did work without your suggested changes, but I added your suggestion to also set the initial color. Also, can you supply more detail how to have similar code working from a Wiindow Controller? I would like to have a toolbar item color wheel trigger a function to change the background color. I created a WindowController.swift file, would it go it there or in NSWindowController.h file?Thanks for your help.
Jun ’20
Reply to How to debug Sqlite Error
This post from 4 years ago describes what I seeing. Sqlite and error 14 - https://developer.apple.com/forums/thread/13691/ I have set the sandbox to the following: File Access Type - User Selected File - Read/Write Any ideas how to fix this? I am thinking this issue is because of sandbox restriction and the SQLite temporary files.
Jul ’20
Reply to Declaring swift Type
I tried what you suggested but it still has the same problem. Although the line let custlist = try Customers.fetchAll(db) sets custlist to an array the type swift uses is type 'Customers' Below is the section of code for Customers if that helps any? Do you see how to fix it now? Thanks import Foundation import GRDB struct Customers {     var id: Int64?     var CustNumber: String?     var CustName: String?     var CustAddr: String?     var CustCity: String?     var CustState: String?     var CustZip: String?     var CustMobile: String?     var CustEmail: String?     var CustNotes: String?     var CustAdded: Date?    } extension Customers: Codable, FetchableRecord, MutablePersistableRecord {     mutating func didInsert(with rowID: Int64, for column: String?) {         id = rowID     } } extension Customers {         private enum Columns {             static let id = Column(CodingKeys.id)             static let CustName = Column(CodingKeys.CustName)             static let CustAddr = Column(CodingKeys.CustAddr)             static let CustCity = Column(CodingKeys.CustCity)             static let CustZip = Column(CodingKeys.CustZip)             static let CustMobile = Column(CodingKeys.CustMobile)             static let CustEmail = Column(CodingKeys.CustEmail)             static let CustNotes = Column(CodingKeys.CustNotes)             static let CustAdded = Column(CodingKeys.CustAdded)         }     }
Jul ’20
Reply to Declaring swift Type
I tried "rowsFetched = custlist as [Customers]" and same result. The catch 22 seems to be that custlist is cast as [Customers] which is really an array but the swift compiler knows them as two different types, although they a really the same? I can't match "types" of rowsFetched with custlist. Also, I would not have to do this if there is a way to make custlist global so I could return the custlist. Any thoughts on this? Thanks
Jul ’20
Reply to Create popup menu from right click event
Claude, Thanks for checking.. working on it. I got a couple of errors I trying to resolve with your code. I wanted to get that working first. However, I have not been able to work on it much yesterday and today...I live in Louisiana and I have Hurricane Laura power issues. I will post the errors I am getting when I get power back.
Aug ’20
Reply to Create popup menu from right click event
For this code inside the view controller inside rightmousedown  let theMenu = popupMenuForValue(absMin: 1, absMax: 10)   NSMenu.popUpContextMenu(theMenu, with: theEvent, for: Self)  I get this error "Cannot convert value of type Self.type to expected argument NSView. Then for this code  @objc func setMaxi(_ sender: NSMenuItem) {           selectedMaxFromMenu = sender.tag         } I get this error "Cannot find selectedMaxFromMenu in scope" .. I think this is due to the first error I am getting. Also, I found a tutorial on context menus at appcoda website "macOS Programming: Using Menus and the Toolbar " that is also helpful, but in this example I don't see how the context menu is connected to the right mouse button? please advise
Aug ’20
Reply to Create popup menu from right click event
Caulde, No damage problem here the storm went far enough west but not so on the Texas Louisiana borders... My bad on the error Self which should be self.. I copied wrong text when I posted. Originally I copied and pasted your code. I was playing around with that code (self). The error I got is as follows: cannot convert value of type 'CustViewController' to expected NSView So, I think I have my right mouse func is in the wrong class. I have it in the view controller class. Or I need more code inside the controller class. How do I fix this? Thanks for your help.
Aug ’20