Possible problem with "register_key_event_handler"

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
Pete Dowson
Posts: 646
Joined: Sat Dec 18, 2010 3:45 pm

Possible problem with "register_key_event_handler"

Post by Pete Dowson »

In FSUIPC I've always used the Gauges API function register_key_event_handler in order, mainly, to offer the option to log key events to help folks resolve problems with their settings.

But I've discovered that just doing this, with no other action taken in the called handler function, certain KEY EVENTS are followed immediately by one or two "KEY ATC MENU CLOSE" events. (It seems to alternate with each use of the triggering event between one and two of these ATC MENU CLOSE events).

The triggering events are those which can be followed by a SELECT 1-4 event, such as TOGGLE AIRCRAFT EXIT, PUSHBACK, and ENGINE. The intervention of those spurious ATC MENU CLOSE events prevents the SELECT from being effective.

If the events are not intercepted then this problem appears not to happen.

So, my questions:
1. Why is this happening?
2. How can it be prevented?
3. Is there (now) a better way to intercept KEY EVENTS, perhaps via PDK facilities?

In FS9, FSX and early P3D days, the interception was possible in the main FS98MAIN window function, as they all passed through as WM_COMMANDs. At some stage in P3D development (version 4?) this seemed to be changed.

Pete
My System

Win10: 22H2 build 19045.2728
Processor: I9 9900KS at 5.5GHz
Mobo: Maximus XI Extreme Z390
Memory: 32Gb at 3900 MHz.
GPU: RTX 24Gb Titan
Displays: 2 x 2160p projectors at 25Hz onto 200 FOV curved screen
P3D5 set with 2 windows using ViewGroups
Pete Dowson
Posts: 646
Joined: Sat Dec 18, 2010 3:45 pm

Re: Possible problem with "register_key_event_handler"

Post by Pete Dowson »

I've been doing lots of tests, and it appears this problem goes back to FSX. It isn't specific to P3D. But I cannot understand why it hasn't caused problems (before).

FSUIPC does use SimConnect's "Macro begin/end" facilities to try to group those Key Events which can take a Select 1-4 qualification with that event. This evidently succeeds in covering up this oddity, though because I've now had a user report that the Shift+E keypress doesn't select other doors with the Select key following, maybe the problem is in the way the Macro facility is operating.

I'll continue investigating, but I would be interested in any theories about what could be causing these spurious ATC MENU CLOSE events.

And is there any way of logging KEY EVENTS without intercepting them? Anything in SimConnect logging? I'd like to see what happens with no add-ons at all running.

Pete
My System

Win10: 22H2 build 19045.2728
Processor: I9 9900KS at 5.5GHz
Mobo: Maximus XI Extreme Z390
Memory: 32Gb at 3900 MHz.
GPU: RTX 24Gb Titan
Displays: 2 x 2160p projectors at 25Hz onto 200 FOV curved screen
P3D5 set with 2 windows using ViewGroups
Pete Dowson
Posts: 646
Joined: Sat Dec 18, 2010 3:45 pm

Re: Possible problem with "register_key_event_handler"

Post by Pete Dowson »

Pete Dowson wrote: Wed Dec 19, 2018 6:31 pmI've now had a user report that the Shift+E keypress doesn't select other doors with the Select key following, maybe the problem is in the way the Macro facility is operating.

No, the macro facility must be working okay, as the FSUIPC provisions for that are certainly enabling the Shift+E then Select event to work correctly to select the exits. Either that, or P3D4 now doesn't allow intervening Events to destroy the relationship of the Select Event with the relevant preceding event (which was the problem in FSX for sure). I'd be interested in L-M's take on that.

I would still be very interested in any theories about what could be causing these spurious ATC MENU CLOSE events.

The problems on my User's system must be specific to his system. Some interaction with another add-on is my guess. I've asked him to test with no other add-ons. We'll see.

Pete
My System

Win10: 22H2 build 19045.2728
Processor: I9 9900KS at 5.5GHz
Mobo: Maximus XI Extreme Z390
Memory: 32Gb at 3900 MHz.
GPU: RTX 24Gb Titan
Displays: 2 x 2160p projectors at 25Hz onto 200 FOV curved screen
P3D5 set with 2 windows using ViewGroups
Post Reply