I'm writing an AppKit application that within its window may open up a popup menu to resolve ambiguities when certain hot keys are pressed. My problem is that the popup seems to catch all keyboard events so they no longer end up in my main NSView and therefore the main view never seems the key up event. The user presses alt+tab, clicks something in the menu, and my app things alt and tab are still pressed when the popup is gone. Since it's a popup, there is also no event indicating that the window became deactive or otherwise lost focus because it didn't.
Is there:
a way for the view to still receive at least the key up that opened the popup?
a way to read all currently pressed keys (I only know of NSEvent modifierKeys) so I can restore the correct state when I know the popup closes?
Thanks
Related
I can't see the detailed job log message from IBM Data Stage Designer (client) from a few days ago. I had worked well by double-clicking the log message on the job log panel, but suddenly it has been stopped to show up in the popup windows.
I tried to push the key combination: Shift + Window + Left/Right arrows, but it still does not provide the job log window. Could anyone has an idea how to make it visible again? I would appreciate it.
If you're working with multiple monitors, maybe on a laptop, changing the connected monitors, then maybe the popup window is showing "outside the box". You already tried to fix it with Shift+Win+←→, but this type of modal window will not stick to that.
Instead, try the following procedure:
Press Alt+SPACE while the window has focus. This will bring up the context menu of the window.
Use the arrow keys ↑,↓ to select Move and press ↵Enter. Do not click on it using the mouse.
The window is now in moving state. Press any arrow key ←↑↓→, just one keystroke.
Now, the window will be stuck to the mouse. Move the mouse around (without clicking) to retrieve the window.
Click once to release the window from the mouse.
In my Xamarin Protable project I have a Entry. What I want is, that after pressing "ok" on the numeric keyboard, the keyboard should not disappear, it should stay open until I press somewhere else on the screen. I used the OnCompleted trigger to set the focus again on the same Entry. It works but there is this little animation of the keyboard where it's disappearing and reopen again. I want that the keyboard should stay open without that animation. Any ideas?
I have a very large accounting system. In a user preferences section, the program has begun to act abnormally on my development machine only. No customers are reporting this, nor can I duplicate it on any of my other computers. Running Windows 8.1, others are on 7.0. Not exactly sure when this started happening because it's not the kind of thing one goes into on a regular basis. The preferences screen consists of a tab control and various standard controls. At the bottom is Okay, Cancel, and Apply buttons. All three buttons seem to be acting with the same strange behaviour. Clicking with a mouse does not generate a click event yet does not hang the system - mouseup follows and you can click it again and see the mousedown and mouseup but no click. However, since the Okay is defined as Default, pressing enter DOES create the desired click event, and all the code inside that even runs fine. Cancel and Okay also unload the form, but when clicked, that doesn't happen because none of the code gets executed, yet you can still navigate the screen (move between tabs and controls) but you can't even click the "X" button to close the form at that point.
Also, if you go straight in, and press enter, everything works and the form unloads, but if you do anything before pressing enter (or escape to cancel), like change a tab and/or edit a value, then press enter, the click event again does not run and the system semi-hangs.
I tried turning-off my anti-virus thinking that might have something to do with it, but no-go. Debugging is frustrating because while I finally got it execute the click event, the stop command inside that event (after debug.print "click") would allow stepping and success if just straight in and enter, but if anything else done as before described would stop at the stop statement (keyboard enter only still no mouse clicks under any scenario) and would do a total lock-out. In other lockouts where it would let me navigate, almost always selecting a new tab would cause a fatal error and it would force-unload VB for me, otherwise I had to use the task manager.
This is driving me nuts, but I don't know how else to debug it.
The culprit was tv_w32.dll which is Team Viewer. Turning-off Team Viewer allows my program to run normally.
I write a MFC application and need a button which is not taling the input focus away from another window.
Removing the WS_TABSTOP style does unfortunately not help when the use clicks the button with the mouse. When i block WM_LBUTTONDOWN i don't get a visual pressed indication so this doesn't work either.
If there is a specific window you want to keep the focus, you could just force the focus back to your window using the CWnd::SetFocus() command in your button's OnLButtonDown handler.
If you want the focus restored to one of several windows, you could try subclassing CButton and trapping the CWnd::OnSetFocus() message which is sent when the keyboard focus changes to the button.
The OnSetFocus() event includes a CWnd of the control that just lost the focus, so you could manually put it back, either as part of the OnSetFocus() event itself, or later as part of the OnLButtonDown() handler again.
I am trying to interface with a cocoa popup menu from an OpenGL button. The actual button needs to be in OpenGL and I cannot stick an actual Cocoa button in its place but when this button is pressed I would like for a Cocoa menu to popup just like the one that comes up when you press the nspopupbutton. It seems that there is no way to get this popup window to come up by itself so I wanted to just insert an invisible button and have it be pressed automatically when the popup menu method is called. Is there a way to programmatically set a button to pressed (this will bring up the menu from the popupbutton) and make the button itself invisible without making the resulting menu invisible?
It seems that there is no way to get this popup window to come up by itself
Sure there is. See + popUpContextMenu:withEvent:forView:
Have you thought about just using a regular NSMenu, rather than trying to finagle the menu from an NSPopupButton?