I have my UIElement set to YES in Info.plist. Then I registered a hotkey. When it's pressed, it calls a NSWindowController object and shows a window.
But I must call NSApp.activate(ignoringOtherApps: true) after mainWindowController.showWindow(self) , causing any other windows blur.
I want to create a window that does not change other window's status but can focus on (or receive local keyboard events), like what Alfred or Spotlight does.
When Alfred is called out, Chrome does not blur. When I hit my keyboard, I typed in Alfred instead of Chrome's input field.
When I press [ESC], Alfred hides. Chrome keeps activated and the text field is still focused on.
Related
I'm trying to get a mac app to open on the current desktop when I use a a global keyboard shortcut (that I've overriden manually in the app). However, when I perform the keyboard shortcut, my desktop switches and shows me the app on the desktop it was previously on instead of the current one. The app is active, but on that other desktop.
Currently, I'm calling:
window?.makeKeyAndOrderFront(nil)
NSApplication.shared.activate(ignoringOtherApps: true)
Thanks in advance for the help.
In Interface Builder, select the window in question, and in the Attributes Inspector, change Spaces from Inferred Behavior to Move To Active Space.
That should allow the window to be shown on the currently active space rather than switching back to whichever space it was shown on last.
You can also do this programmatically by modifying the window's collectionBehavior:
window.collectionBehavior.insert(.moveToActiveSpace)
when I ran my Xcode and went to type "Vatican City" in it , I typed Vatican using simulator keyboard and mistakingly typed City with my laptop keyboard.
once I pressed my laptop key , the simulator keyboard disappeared from the screen.
Now whenever I run my app and press on the UITextField, I do not get my simulator keyboard to pop up to take user input but it take input via my laptop keyboard
The properties in the attributes pane have been the same and nothing has been changed manually by me for my simulator to function like this. what should I do to get the simulator keyboard to pop up again when I want to give some user input?
enter image description here
Try enabling your software keyboard:
Shortcut keys: Cmd+Shift+K
In my menu bar app, I have a menu item which opens a window. The window opens in the front with the window behind it remaining the key window.
I can't get window.makeKey() to work unless I run it after a breakpoint. I tried putting the line of code in different places in the window's life cycle and even put it in DispatchQueue.main.asyncAfter(deadline: execute:) and it didn't work.
I have also tried using window.makeKeyAndOrderFront(sender:). The property window.canBecomeKey is true.
Turns out I needed to put this line in the IBAction for the menu item that opens the window:
NSApplication.shared.activate(ignoringOtherApps: true)
That makes it the key window when it opens, so I don't have to call window.makeKey()
I'm using GTK on Linux. (Both GTK2 and GTK3 exhibit this behavior.)
When you grab the window on some free space or menubar, the window itself gets dragged.
I'm using the window as a giant OpenGL canvas, and this prevents the primary mouse button presses from ever reaching the window. Double-clicks and secondary button presses arrive just fine.
How do I disable or work around this behavior? I've also tried adding a GtkDrawingArea to the window, but it still gets dragged.
This is not possible. GTK overrides the function of primary mouse button unconditionally. However, simply adding an empty GtkLabel to the window worked just well for me.
Edit: eventually I just used a GtkDrawingArea, because I also wanted a scroll/menubar. That works just as well.
Gtk does grab unconditionally, but you have full control of what that specific "click" will do.
Returning True from any "button-xxx" method will stop further processing from Gtk. See "Return type" here.
I am experiencing following problem with ipython-qtconsole:
I type in ipython-qtconsole window, then I switch to another application window with Alt+Tab. When I switch back again into ipython-qtconsole the text area is no longer selected/activated, but rather the menu. That means, when I start typing or hit enter, I am actually in the top menu. I have to click with the mouse in the text area first, and then I can start typing.
Is this normal behavior? I cannot imagine that anybody would want this "functionality". Is it possible to change it, so that when ipython-qtconsole window is activated, the text area is automatically active (i.e. the cursor is there) ?