View Issue Details

IDProjectCategoryView StatusLast Update
0015279LazarusIDEpublic2011-08-19 02:35
ReporterLuiz Americo Assigned ToJuha Manninen  
Status closedResolutionfixed 
Target Version1.0.0 
Summary0015279: The focus does not return to the IDE after closing the running program
DescriptionSteps to get the issue:

Run the project inside the IDE (F9)
Set the focus to the Source Editor
Stop the running application (Ctrl-F2)
> The focus is not returned to the IDE/Source Editor. If i try to run again the program (F9) nothing occurs. It's necessary to click in the Source Editor or in another IDE window to get the focus and the commands (F9 etc) can be executed again.

This problem occurs only on win32. Tested with gtk2 and Qt without problems

Using Lazarus 0.9.29 r22953 FPC 2.4.0 i386-win32-win32/win64
TagsNo tags attached.
Fixed in Revision
Attached Files


duplicate of 0014294 closedMartin Friebe Stop debug with ctrl-F2, moves focus away from Editor 
related to 0015494 closedPaul Ishenin Trouble with focus 
related to 0015967 closedJuha Manninen When debugging a GUI application and breakpoint is hit, focus doesn't move to editor 


Dmitry Boyarintsev

2009-12-07 20:14

developer   ~0032795

seems like the Application window gains the focus (not the main or last focused)

Graeme Geldenhuys

2009-12-08 11:14

reporter   ~0032807

This issue also happens under Linux (GTK2), but after a "Find in Files.." action. When the find Results screen is displayed and I double click on a result, it opens the target unit, but focus is NOT in the editor.

Pressing the up/down arrows or trying to do another Ctrl+F (find) yields no results. I have no clue where the actual focus is to be honest.

I have to physically click in the editor window to get focus in the editor. Very annoying if you program with keyboard short-cuts and not the mouse.

samuel herzog

2009-12-13 18:23

developer   ~0033043

I just tried to fix this by placing this in method <TMainIDE.HideIDE>


and this in method <TMainIDE.UnhideIDE>

if assigned(fActiveForm) then fActiveForm.SetFocus;

But always the "MessagesView"-Dialog gets the focus.
So I look's as if I hit F9 then somewhere automatically the MessagesView-Dialog is focused and after that the HideIDE mehtod is called.

samuel herzog

2009-12-15 19:23

developer   ~0033114

The statement
<MessagesView.Visible:=false;> in mehtod <TMainIDE.DoRunProject> solves the problem but I think this is not the right place to put my code.

Luiz Americo

2009-12-15 19:55

developer   ~0033116

Seems its necessary to store something like LastActiveWindow

Compile -> This will bring Messages Window to front
Run App -> Focus is Lost
App Finished -> Focus returns to IDE
Set Focus to LastActiveWindow

Dmitry Boyarintsev

2009-12-15 20:50

developer   ~0033118

it won't work if LastActiveWindow were closed (or destroyed) during Application Run.

Flávio Etrusco

2010-03-12 16:42

developer   ~0035371

This was fixed for gtk2, please mark resolved/fixed if ok.

Flávio Etrusco

2010-03-12 17:04

developer   ~0035379

I can confirm it's still present (After making noticing I overlooked the fact that it was clearly stated as being a win32-only bug, the least I could do was stop everything I had in Linux and try it in Windows, sorry :-$ )

samuel herzog

2011-08-16 20:13

developer   ~0050877

I can not reproduce this bug anymore with today's svn version Lazarus 0.9.31 r31994 FPC 2.4.4 i386-win32-win32/win64.

May someone else also try this?

Juha Manninen

2011-08-16 21:28

developer   ~0050881

Indeed, it is fixed in the meantime.

Issue History

Date Modified Username Field Change
2009-12-07 19:09 Luiz Americo New Issue
2009-12-07 19:09 Luiz Americo Widgetset => Win32/Win64
2009-12-07 20:14 Dmitry Boyarintsev Note Added: 0032795
2009-12-08 11:14 Graeme Geldenhuys Note Added: 0032807
2009-12-08 13:06 Martin Friebe Relationship added duplicate of 0014294
2009-12-11 13:20 Vincent Snijders LazTarget => 1.0
2009-12-11 13:20 Vincent Snijders Status new => acknowledged
2009-12-11 13:20 Vincent Snijders Target Version => 1.0.0
2009-12-13 18:23 samuel herzog Note Added: 0033043
2009-12-15 19:23 samuel herzog Note Added: 0033114
2009-12-15 19:55 Luiz Americo Note Added: 0033116
2009-12-15 20:50 Dmitry Boyarintsev Note Added: 0033118
2010-01-23 10:42 Dmitry Boyarintsev Relationship added related to 0015494
2010-03-12 00:42 Juha Manninen Relationship added related to 0015967
2010-03-12 16:42 Flávio Etrusco Note Added: 0035371
2010-03-12 16:42 Flávio Etrusco Status acknowledged => feedback
2010-03-12 17:04 Flávio Etrusco Note Added: 0035379
2010-03-12 17:04 Flávio Etrusco Status feedback => acknowledged
2011-08-16 20:13 samuel herzog Note Added: 0050877
2011-08-16 21:28 Juha Manninen Status acknowledged => resolved
2011-08-16 21:28 Juha Manninen Resolution open => fixed
2011-08-16 21:28 Juha Manninen Assigned To => Juha Manninen
2011-08-16 21:28 Juha Manninen Note Added: 0050881
2011-08-19 02:35 Luiz Americo Status resolved => closed