Description

If a user uses Alt-tab to change to another window, the ReceivedFocus and LostFocus functions are not called as they would usually be called when using something such as Shift+F1 or Ctrl+Esc.

Note: As of CL#2842291, following the old steps above results in ReceivedFocus and LostFocus being called repeatedly, due to needing to hit "Continue" in Visual Studio to move past the breakpoint (Makes the standalone window lose focus). If using the new steps, the reproduction should work correctly.

Steps to Reproduce

New Steps:
1. Create a new blank code (C++) project and open the .sln file
2. Search for 'GameViewportClient.cpp' in the Solution explorer and open the GameViewportClient.cpp file
3. Inside the file, hit ctrl+F to open the 'Find' dialogue and enter "LostFocus"
6. On line 1368 (The first line inside of the definition of LostFocus) set a breakpoint.
7. Press F5 to start the project in Debug (If you are asked to compile the project, select Yes)
8. Once the project is open, start the game in a Standalone App (Select the dropdown arrow beside the play button to find this option)
9. Once the standalone app is open, go back to Visual Studio and select Debug > Attach to Process
10. Find the UE4Editor process that is not grayed out (The grayed out one is the currently attached process) and select Attach
11. Focus on the Standalone App and press Alt+tab
Result: The compiler does not break and continues like normal
Expected: The breakpoint set earlier should trigger and pause debugging

To get the expected result with other keybindings:
1. Return to the Standalone App and press Shift+F1
Result: Breakpoint is triggered.

Old Steps:
1. Create a new blank code (C++) project and open the .sln file
2. Search for 'GameViewportClient.cpp' in the Solution explorer and open the GameViewportClient.cpp file
3. Inside the file, hit ctrl+F to open the 'Find' dialogue and enter "ReceivedFocus"
4. Beside line 1373 (The definition of ReceivedFocus) set a breakpoint.
5. Press ctrl+F again and enter "LostFocus"
6. On line 1350 (The definition of LostFocus) set a breakpoint.
7. Press F5 to start the project in Debug (If you are asked to compile the project, select Yes)
8. Once the project is open, start the game in a Standalone App (Select the dropdown arrow beside the play button to find this option)
9. Once the standalone app is open, go back to Visual Studio and select Debug > Attach to Process
10. Find the UE4Editor process that is not grayed out (The grayed out one is the currently attached process) and select Attach
11. Focus on the Standalone App and press Alt+tab
Result: The compiler does not break and continues like normal
Expected: The breakpoint set earlier should trigger and pause debugging

To get the expected result with other keybindings:
1. Return to the Standalone App and press Shift+F1
Result: Breakpoint is triggered.

Have Comments or More Details?

Head over to the existingAnswerHub thread and let us know what's up.

0
Login to Vote

Fixed
ComponentTools
Affects Versions4.84.9
Target Fix4.11
Fix Commit2877802
Main Commit2905127
Release Commit2839715
CreatedSep 9, 2015
ResolvedFeb 23, 2016
UpdatedApr 27, 2018