unknown
unknown

Reputation: 1018

Keep window in focus always in swift Cocoa

I'm currently working on a "floating" window. The window contains a tableview with clickable rows.

var myPanel = NSPanel()

func mClipboardConfig(){
        mtPanel = NSPanel(contentRect: CGRect(x: 100, y: 100, width: 50, height: 200), styleMask: [.titled, .nonactivatingPanel], backing: .buffered, defer: true)
        mtPanel.delegate = self

        mtPanel.isFloatingPanel = true
        
        mtPanel.makeKeyAndOrderFront(self)
        mtPanel.orderFrontRegardless()
        
        let storyboard = NSStoryboard(name: "MiniCipBoardSB", bundle: nil)
        
        var controller = MiniClipboardVC()
        controller = storyboard.instantiateController(identifier: "mClipboardID") as MiniClipboardVC
   
        mtPanel.contentViewController = controller
        
       
}

enter image description here

The window "floats" above other windows as expected, but the issue is that in order to select a row I have to click on the window twice to select a row(once to "activate" the window and another to click on the row).

Is it possible to select a row in this window (with one click) while another application is in focus.

Upvotes: 0

Views: 39

Answers (0)

Related Questions