5.1 SimConnect menu not responding to keypress

Any issues, problems or troubleshooting topics related to the Prepar3D client application.
Post Reply
737SimGuy
Posts: 71
Joined: Tue Apr 01, 2014 9:40 pm
Location: Northern California

5.1 SimConnect menu not responding to keypress

Post by 737SimGuy »

Anyone else have an issue with a SimConnect menu (such as GSX) not responding to keypress, only responds to a mouse click?

James

Version 5.1
Win 10 20H2
32gb ram
737SimGuy
Posts: 71
Joined: Tue Apr 01, 2014 9:40 pm
Location: Northern California

Re: 5.1 SimConnect menu not responding to keypress

Post by 737SimGuy »

This appears to be a window focus issue. For me when the menu pops up the keypress will not affect it, but if I click on the menu window to give it the focus then the keypresses work.

James
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

I'm having this issue also. In fact, I think perhaps everyone is having this issue but most aren't noticing it because they use the mouse to select menu options.

This is a pretty major problem for anyone who doesn't do point-and-click flying and who uses GSX or other add-ons that generate a SimConnect menu. I rely on keyboard entry to control GSX and Pro-ATC/X and neither will now work unless I click on the menu first to focus it. Having given the menu the focus, if I dismiss it and then re-open it it retains the focus until something else takes it, but that means any time you use the sim menu, or need to interact with a program outside the simulator (which is all the time in my case), you have to go through this all over again.

It's really concerning that no-one from LM has responded to this question, because this is a significant issue and it's very easy to replicate this behaviour. It happens whether the menu is docked or undocked. Just bring up the SimConnect menu with a key combination, do not click the menu to make sure it doesn't have focus, and press one of the shortcut keys. It will not be recognised. Scaleform menus recognise keyboard shortcuts as long as *any* Prepar3d window is focussed.

Is there any way to turn off the HTML menus and revert to the Scaleform ones? Removing or disabling the HTML5 entry in uipanel.cfg stops the menu from appearing at all.
737SimGuy
Posts: 71
Joined: Tue Apr 01, 2014 9:40 pm
Location: Northern California

Re: 5.1 SimConnect menu not responding to keypress

Post by 737SimGuy »

neilhewitt wrote: Sun Dec 20, 2020 9:31 pm ...
Is there any way to turn off the HTML menus and revert to the Scaleform ones?
There is, I'm trying to find it again stby...

James
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

(I should note that this is definitely not a GSX or Pro-ATC/X issue. I've replicated it on 3 installs of P3D including a new vanilla 5.1 HF1 install without any add-ons installed. It happens with any SimConnect menu including the built-in ATC.)

The HTML5 menus (you can find the source in the \HTML5 folder off your P3D folder) use a keypress listener in JavaScript to key events, and this will only see keypresses that are targeted at the HTML5 window itself (for the same reason that any JavaScript running in your browser can't see keypresses that you make when you don't have that browser window focussed - for obvious security reasons). I'm a Web developer by trade so this is my area of expertise.

I don't know which HTML engine the sim is using under the hood to render the menus (though I'd take a bet it's Chromium) but unless the sim is relaying any keypresses to the HTML window directly so that they occur in the context of the HTML window itself, then keyboard shortcuts will never work when the menu is not focussed.

To me this looks like something that needs to be addressed in the next hotfix.
User avatar
Martyson
Posts: 15188
Joined: Sun Mar 25, 2012 11:08 am

Re: 5.1 SimConnect menu not responding to keypress

Post by Martyson »

@ neilhewitt ,

Do you have the same problem if:
If you reboot PC and load the default flight F-35A at KRND then Key to bring up ATC then key to select menu items ?

In your P3D Options,
Other Controls are you using (checked) Enable Advanced Mouse Controls?
Best Regards,
Vaughan Martell PP-ASEL (KDTW)
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

Hi Martyson,

Yes, I have the problem in the default flight with the ATC menu *provided the menu does not have the focus*. If I bring it up in the main P3D window and press a key then it works, because P3D gives it the focus when it's created. But if I click on another P3D window then it loses focus and doesn't work. Also, if you undock the ATC window itself then it doesn't work at all unless you click on the undocked window to give it the focus.

Basically, the problem is when the focus moves away from the main P3D screen, which has given the focus to the ATC menu. This happens if you click on an undocked window while you have the ATC menu open, or if you click on another docked SimConnect menu in the main P3D window, or if you have a SimConnect window undocked that doesn't have the focus.

Repro steps:

1. Reboot
2. Start P3D, select default flight
3. Open Default GPS window (Vehicle -> Instrument Panel -> Default GPS)
4. Bring up ATC window (@ key)
5. Press key 1 - note that this is recognised by the ATC window
6. Close ATC window
7. Undock the Default GPS window and click the undocked window to focus it
8. Bring up ATC window (@ key)
9. Press key 1 - note that this is *not recognised* by the ATC window

Here's a second repro that doesn't rely on undocked windows:

1. Reboot
2. Start P3D, select default flight
3. Open the Panel Manager window (Vehicle -> Instrument Panel -> Panel Manager)
4. Bring up ATC window (@ key)
5. Click title bar of Panel Manager window (note this is *not* undocked)
6. Press key 1 - note that this is *not recognised* by the ATC window

The same happens with all HTML5 SimConnnect menus.

With the Scaleform menus, both of these scenarios will work as expected (that is, keypresses are registered regardless of which P3D window has the focus, because P3D is the foreground application whenever any of its windows are focussed, but in the case of the HTML5 menus that is not enough for the HTML5 renderer to see the keypresses, the HTML5 window must be focussed *itself* in order for the key events to be generated in JavaScript. That's a limitation of all HTML rendering engines.
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

Oh, and I have disabled Advanced Mouse Controls. I did this specifically as part of my investigation, but it doesn't matter whether it's enabled or not, the repro works in either case.
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

Last post as it's late in my timezone, I'll reply to any further questions / answers in the morning UK time.

I've found a workaround that will work in my specific use case (but not generally). In my simpit, I use a small keypad built into the main instrument panel to send number keypresses for menus etc. This is wired up through SPAD.Next since the keypad appears to windows as a game controller. SPAD.Next sends the actual keypresses, and it can be set up to send them to a specific window class name. SimConnect menus have the class name FS98FLOAT, so if I target that class then my keypresses are sent directly to the SimConnect window message queue and the menu will pick up the keypress.

(I should note that for my testing and repro steps given above I was using the keyboard to send keypresses, not the SPAD.Next route, because I wanted to exclude this as a possible culprit. On the development PC that I have my vanilla P3D install on, I do not have SPAD.Next installed [or GSX or Pro-ATC/X or other add-ons that use the SimConnect menus]. BTW, I'm an add-on developer as well - so I know SimConnect etc.)
737SimGuy
Posts: 71
Joined: Tue Apr 01, 2014 9:40 pm
Location: Northern California

Re: 5.1 SimConnect menu not responding to keypress

Post by 737SimGuy »

737SimGuy wrote: Sun Dec 20, 2020 10:00 pm
neilhewitt wrote: Sun Dec 20, 2020 9:31 pm ...
Is there any way to turn off the HTML menus and revert to the Scaleform ones?
There is, I'm trying to find it again stby...

James
Here are the instructions to disable the HTML menus:

Modify the missionpanels.cfg in the gauges folder in your
Prepar3D installation directory.
Changing these entries will revert these windows back to the Scaleform version:

[Window10]
change:
html_file = menu;
html_instance_name = MenuPrompt;
to:
scaleform_file = menuwindow;
scaleform_instance_name = MenuPrompt;

[Window11]
change:
html_file = ATC;
html_instance_name = ATC;
to:
scaleform_file = menuwindow;
scaleform_instance_name = ATC;

[Window12] ; for GSX
change:
html_file = Menu;
html_instance_name = SimConnectWindow;
to:
scaleform_file = menuwindow;
scaleform_instance_name = SimConnectWindow;
neilhewitt
Posts: 49
Joined: Mon Jan 09, 2012 12:29 am

Re: 5.1 SimConnect menu not responding to keypress

Post by neilhewitt »

@ 737SimGuy - that's brilliant, thank you. As I just posted I have another workaround too but it's very specific to my setup and wouldn't work for others. This should work for everyone.

Hopefully LM will fix this - it's definitely fixable, they just have to ensure keypresses are sent to all open P3D windows rather than just the active window. This will let the HTML5 renderer pick up the keypress. Windows key handling is a bit of a dark art for Win32 applications!
737SimGuy
Posts: 71
Joined: Tue Apr 01, 2014 9:40 pm
Location: Northern California

Re: 5.1 SimConnect menu not responding to keypress

Post by 737SimGuy »

neilhewitt wrote: Sun Dec 20, 2020 10:54 pm @ 737SimGuy - that's brilliant, thank you. Windows key handling is a bit of a dark art for Win32 applications!
You are most welcome.

BTW, if you use FSUIPC it has specific calls to send the menu selections for these menus, without the need for the menu to have the focus...

James
Kwichel
Posts: 3
Joined: Wed Mar 04, 2015 11:49 am
Location: Germany

Re: 5.1 SimConnect menu not responding to keypress

Post by Kwichel »

737SimGuy: Thanks a lot for the tip. That has solved my problem.
I also hope that LM will solve the problem soon with a hotfix.

Karl
User avatar
Martyson
Posts: 15188
Joined: Sun Mar 25, 2012 11:08 am

Re: 5.1 SimConnect menu not responding to keypress

Post by Martyson »

Kwichel wrote: Mon Dec 06, 2021 9:07 am 737SimGuy: Thanks a lot for the tip. That has solved my problem.
I also hope that LM will solve the problem soon with a hotfix.

Karl
@ Kwichel
Karl

This topic is a year old and about P3D5.1

Just to verify, are you using P3Dv5.1 ?

Current version is P3Dv5.3
Best Regards,
Vaughan Martell PP-ASEL (KDTW)
Kwichel
Posts: 3
Joined: Wed Mar 04, 2015 11:49 am
Location: Germany

Re: 5.1 SimConnect menu not responding to keypress

Post by Kwichel »

Yes, I have read that.
But it solved my problem with ATC window, GSX window etc in P3Dv5.3.
Calling GSX menue caused a crash for me.

Karl
Post Reply