View Issue Details

IDProjectCategoryView StatusLast Update
0022475LazarusLCLpublic2014-09-21 20:36
ReporterStefanoAssigned ToJesus Reyes 
Status resolvedResolutionfixed 
Product Version0.9.30.4Product Build 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0022475: TForms and Alt+Tab (DbGrid and other controls)

there are problems going from one form to another of the same program with Alt + Tab

After jumping to another form with Alt + Tab and Alt + Tab to be returned to the starting form:

-If I was in Insert / EditState on a DBEdit (of the starting form), the changes are lost;

-If I go on a DBGrid (of the starting form) I get problems in Insert / Edit of the cells: each character I enter replaces the preceding character, so the text seems to remain always one character long.

But if I move using the TaskBar to get from one form to another, without using Alt + Tab, everything works fine.

When the problem occurs (Alt + Tab), sometimes clicking on the Taskbar on the main form and then reducing it to an icon, sometimes the problem is solved (without having to exit the form).

The problem occurs from Lazarus 0.9.30, remained with the and also with With Lazarus everything works fine.

Best regards,

TagsNo tags attached.
Fixed in Revision42923, 46276
WidgetsetGTK 2, Win32/Win64
Attached Files



2012-09-04 08:57

reporter   ~0062054

The problem remains with version 1.0 and Linux/GTK2.

I am forced to still use version, that is quiet old.

Changing from a form to another form is very important for complex projects.

Best regards,


2012-09-05 17:59 (177,057 bytes)


2012-09-05 18:04

reporter   ~0062102

I've attached a sample file that uses a database Firebird. You can use the unit that uses SQLDB or the unit that uses UIB + FBDataset, at your choice. You need to set se path to your Firebird DB.

About the problem with the DbGrid, the bug is related to the new bug n. 0022804:
-The DbGrid hat a problem;
-With Alt+Tab this problem becomes hard;
-The Alt+Tab problem occours with other contorls different to DbGrid, as DbEdit.

So there are 2 different problems.

About the Alt+Tab problem I confirm that deplacing from forms/windows at run time with Alt+Tab give problems with data-aware controls when returning on the form of departure.

The problem occour in Event Activate:
-Deplacing with Alt+Tab and return with Alt+Tab: the problem occour;
-Deplacing with mouse on TaskBar and return with mouse on TaskBar: no problem;
-Deplacing with mouse on TaskBar and return with Alt+Tab: the problem occour;
-Deplacing with Alt+Tab and return with mouse on TaskBar: no problem.

*DbEdit text lost changes when returning on the forms: this is easy to bypass
with a Post command on the Deactivate event;
*DbGrid make difficoult to insert text in the cells: sometimes in the first
cell is ok, but with next cells the problem occour: the cell hat no red
border and each character replace the other.


2012-09-05 21:36

reporter   ~0062109

The problem seems to concern above all the Currency Fields. When with Alt+Tab the user go to a StringFieldCell, it seems work, but when the user go to a CurrencyFieldCell the problem occours. When the problem occours, after that also StringFieldCell have the problem.


2012-09-13 11:12

reporter   ~0062323

About the DbGrid:

1) The problem seems to occour always when the user move with Alt+Tab from the mainform to a secondary form with dbgrid, even without a procedure in the KeyDown event of the dbgrid that navigate in the dataset.

You can easy see that in the Test project: if you comment the procedure CalcTotali, you can move between the secondaries forms without problems (frmunitdbgrid, frmunituib, frmUnitText), but if you move from the mainform (mymainform) to a dbgridform (frmunitdbgrid or frmunitdb) with Alt+Tab the problem on the dbgrid occours, also with CalcTotali commented.

This problem ococurs with all kind of fields (event StringFields).

When the problem occours, I must click with the mouse on the mainform on the TaskBar, after that with the mouse I muss choose the dbgridform from the TaskBar.

2) Moreover, I have sometimes noted that the problem occours also without navigating into the dataset in the KeyDown event of the dbgrid, but only reading/writing data of the same row.

3) However, the problem seems concern only the arrows or the deplacement keys in the KeyDown event of the DbGrid and not the function Keys, that seem to work even with navigating into the dataset.

If in the Test project I add in the DbGrid_KeyDown event this code:

  if (Key = 121{KeyF10}) then begin

it seems that there are no prblems with Alt+Tab. The same code for arrows keys give problems with Alt+Tab:

  if (Key = 38 {KeyArrowUp}) or (Key = 40 {KeyArrowDown}) then begin
    if (dbgrid1.SelectedIndex = 2) then begin

2012-09-23 16:26 (180,461 bytes)


2012-09-23 16:41

reporter   ~0062586

Last edited: 2012-11-22 00:15

Hello, I've updated the simple project. I've simplified the code, commented the code not necessary to reproduce the problem and eliminated the unit that uses SQLDB.

So the test project is now easier und complete to show the problem.

In the mymainform.pas I've explained all the problems.

I've added useful comments to the code.

If you don't wont to use Firebird and/or UIB/FbDataSet you can easy addapt the code to any other base data of your choice.

I've made also a short Video, that shows the test project running, and so it shows the problems. You can download this video in AVI format here:

I think that now it is easier for you to reproduce the problem.

I've added the new project file even to bug 0019993. The sample project shows in fact all these (different) bugs.

Best regards,



2012-11-05 15:33

reporter   ~0063676

The problem still remains with version 1.0.2 of Lazarus.

For Linux/GTK2 I must still compile with Lazarus that works fine.

Best regards,



2013-03-24 17:10

reporter   ~0066528

I've installed Lazarus 1.0.8, unfortunatelly the problem still remains.

Using Alt+Tab to moving between the forms of the same program give problems, after that is is no possibile to use the grid to insert data.

I don't know where is the problem, if at deactivate or reactivate. It seems in the activate, because on deplacing with mouse on TaskBar and return with Alt+Tab the problem occours, while on deplacing with Alt+Tab and return with mouse on TaskBar the are no problems.

However if I move to the main form with Alt+Tab and from the main form return on the form with the DbGrid by a windows menus (that uses the method Show) the problem occours. But if I move to the main Form without Alt+Tab and here I use the windows menu to return the problem doesn't occour.

Deplacing to/from the main form with Alt+Tab is the situation more difficoult: I cannot set set the property ShowInTaskBar to stNever in order to bypass the problem.

I must continue to use version

Any idea to try to bypass the problem, until the bug will be corrected, would be very appreciated, I'dd like to use the current version of Lazarus.

Best regards,



2013-06-13 00:20

reporter   ~0068266

The problem unfortunately remains with version 1.0.10 of Lazarus. I find no differences with version 1.0.8.

Above all the problem is when the user moves from the main form with Alt + Tab to another opened form with a DbGrid.

A great thanks if you can solve the problem, or tell me a way to bypass the problem, in order to can use the current version of Lazarus (I must continue to use version of Lazarus).

Best regards,



2013-06-27 19:50

reporter (139,008 bytes)


2013-06-27 19:50

reporter (43,123 bytes)


2013-06-27 19:59

reporter   ~0068612

Hello, I've noted, that the problem occours if the forms to show are one over/under the others.

If I have a little form and another little form, that are in different places of the screen, I can move from them with Alt+Tab without problem.

If the forms are also partialy one over the other in the screen, moving from the forms with Alt+Tab give the problem.

It seems that the problem occours when the dbgrid is "covered" from another form.

The problem seems occours in the event Activate of the form.

If I move with Alt+Tab and return with the mouse, the problem doesn't occour on this form.

If I move with the mouse and return with Alt+Tab the problem occours on this form.

Sorry for my bad English.

I join the test project with the main form with greter with and height, so it is easy to reproduce the problem.

The test project show also 2 other problems of the DbGrid.

I hope than you can solve at less the Alt+Tab problem, that is very serious and force me to use the version of Lazarus, that is quite old.

This would be particularly urgent

Thank you very much.

Best regards,



2013-07-03 18:32

reporter (325,176 bytes)


2013-07-03 18:37

reporter   ~0068714

I've joined a sample project that use SQLite, so you haven't to install anything.

The project uses SQLDB that is a component of Lazarus.

You must only have the on your system directories. SQLDB search the library with this name, so if you have a file named (X is the version) you have to link (or copy and rename) with the name

Of course it is necessary to set correctly the property DataBaseName to the path to the DB (file MyTestDb) on your system.

I hope you can solve the problem.

Thank you very much.

Best regards,



2013-11-12 16:52

reporter   ~0071281

The patch works fine on Linux/GTK2, thank you very much.

The problem with the DbGrid is now resolved!

It remains the problem with the other DataAware controls, e.g. TDbEdit, when the user move from a form to a form of another software with Alt+Tab: the current updates of the control (that have not yet a Post) are lost.

When the user move with the mouse there are no problems.

Unfortunately it seems that it isn't more possibile to bypass the problem using the Deactivate event. If I put in the code of the Deactivate event a Post to the dataset, nothing appears, because the Deactivate event seems to be not raised when the user deplace with Alt+Tab from a Lazarus form to another opened windows (other software, not the Lazarus project). The Deactivate event works fine only when the user deplace with Alt+Tab bewtween the forms of the same project.

The problems semmes to concern only Linux/GTK2, I think this is always a problem with the X11 environnement.

Thank you again.

Best regards,



2013-11-15 18:54

reporter   ~0071325

Last edited: 2013-11-15 18:57

View 2 revisions

Hello, I've noted that it is possibile to bypass the problem of the Alt+Tab with the TDbEdit with a Post statement of the dataset in the event Paint of the forms.

I've added a Post command in the Deactivate and in the Paint events of the forms and now it seems to work correctly.

Best regards,


Issue History

Date Modified Username Field Change
2012-07-21 15:52 Stefano New Issue
2012-07-21 15:52 Stefano Widgetset => GTK 2, Win32/Win64
2012-09-04 08:57 Stefano Note Added: 0062054
2012-09-05 17:59 Stefano File Added:
2012-09-05 18:04 Stefano Note Added: 0062102
2012-09-05 21:36 Stefano Note Added: 0062109
2012-09-06 07:11 Jesus Reyes Status new => assigned
2012-09-06 07:11 Jesus Reyes Assigned To => Jesus Reyes
2012-09-13 11:12 Stefano Note Added: 0062323
2012-09-23 16:26 Stefano File Added:
2012-09-23 16:41 Stefano Note Added: 0062586
2012-11-05 15:33 Stefano Note Added: 0063676
2012-11-22 00:15 Stefano Note Edited: 0062586
2013-03-24 17:10 Stefano Note Added: 0066528
2013-06-13 00:20 Stefano Note Added: 0068266
2013-06-27 19:50 Stefano File Added:
2013-06-27 19:50 Stefano File Added:
2013-06-27 19:59 Stefano Note Added: 0068612
2013-07-03 18:32 Stefano File Added:
2013-07-03 18:37 Stefano Note Added: 0068714
2013-08-31 06:55 Jesus Reyes LazTarget => 1.2
2013-08-31 06:55 Jesus Reyes Target Version => 1.2.0
2013-09-24 18:31 Jesus Reyes Fixed in Revision => 42923
2013-09-24 18:31 Jesus Reyes Status assigned => resolved
2013-09-24 18:31 Jesus Reyes Fixed in Version => 1.3 (SVN)
2013-09-24 18:31 Jesus Reyes Resolution open => fixed
2013-11-12 16:52 Stefano Note Added: 0071281
2013-11-12 16:52 Stefano Status resolved => assigned
2013-11-12 16:52 Stefano Resolution fixed => reopened
2013-11-15 18:54 Stefano Note Added: 0071325
2013-11-15 18:57 Stefano Note Edited: 0071325 View Revisions
2014-02-15 20:51 Martin Friebe LazTarget 1.2 => 1.4
2014-02-15 20:52 Martin Friebe Target Version 1.2.0 => 1.4
2014-09-21 20:32 Jesus Reyes Fixed in Revision 42923 => 42923, 46276
2014-09-21 20:32 Jesus Reyes Status assigned => resolved
2014-09-21 20:32 Jesus Reyes Resolution reopened => fixed