View Issue Details

IDProjectCategoryView StatusLast Update
0021352LazarusIDEpublic2014-10-02 11:01
ReporterBruce Tulloch Assigned To 
Status acknowledgedResolutionopen 
Product Version0.9.31 (SVN) 
Summary0021352: Source Editor flashes every time a new tab is selected.
DescriptionThe source editor flashes in a headache inducing way every time a new tab is selected, either directly or via other means (e.g. control-click on a symbol).
Steps To ReproduceWhen Lazarus first starts with a few tabs open, one can switch between them and this problem never occurs.

However, as soon as a new tab is created (by opening a new file for example) the selection of a different open tab is usually accompanied by a bright flash (made even more obvious by my use of the Twilight theme but it happens regardless of the theme in use).

The problem can be stopped temporarily by restarting Lazarus but it returns as soon as the editor opens a new tab.
Additional InformationI'm guessing there's a "error status flag" somewhere in the UI that is being erroneously set to cause this (otherwise intentional) flashing behaviour to occur.

Can this flash be disabled via the UI settings somehow? If not I think even if this bug is fixed it would be good to allow the "flash on error" behaviour to be disabled via a user preference. Sorry if I've missed some obvious configuration option somewhere if it already is possible to do this. If so, how do it do it?

I've marked this one minor but it really does induce a headache after a few hours of working with it so it's not so minor from this poor user's point of view :-(
TagsNo tags attached.
Fixed in Revision
WidgetsetGTK 2
Attached Files


related to 0022080 resolvedPaul Ishenin Blinking of TPageControl when switching tabs 


Zeljan Rikalo

2012-02-23 09:22

developer   ~0057016

Can you try to comment Screen.RestoreLastActive in TApplication.Activate and give feedback ?

Bruce Tulloch

2012-02-23 11:26

reporter   ~0057018

Did the following, recompiled and re-run, no change.

--- a/lcl/include/
+++ b/lcl/include/
@@ -1424,7 +1424,7 @@
   if AppActive in FFlags then exit;
   Include(FFlags, AppActive);
- Screen.RestoreLastActive;

Martin Friebe

2012-02-23 12:06

manager   ~0057021

This happens on Windows too.

Might be WM_ERASEBKGND to the SourceNotebook,
setting a break in lcl\interfaces\win32\
for B:\lazarus_latest\lcl\interfaces\win32\ for

shows that when switching the tabs, first the current Page gets "emptied" (tab still active, white page), then the new tab is shown in white, then the new SynEdit gets to paint

Zeljan Rikalo

2012-02-23 12:33

developer   ~0057022

@Bruce, I cannot reproduce it. Fedora 14 gtk2-2.24, trunk lazarus.
Please give more information about your operating system and gtk2 version.

Bruce Tulloch

2012-02-23 12:45

reporter   ~0057023

Last edited: 2012-02-23 12:46

Linux 2.6.32-5-686 SMP i686
Debian Version 6.0.3 (Squeeze)
GTK2 Version 2.20.1-2

Zeljan Rikalo

2012-02-23 17:08

developer   ~0057032

But it wasn't before and I cannot reproduce it under linux (qt or gtk2), also tested ancient gtk2-2.8.15 on fedora 3, and there it works fine too, so there must be something with your WM or X.
So, which WM do you use ? Is compiz enabled ?

Martin Friebe

2012-02-23 19:26

manager   ~0057041

I can also see it under Fedora-13. (xfce)
Need a dark color-scheme, and only happens if:
- IDE started/loads several tabs
- switching mow - all fine
- open extra tabs (via ctrl click)
- switching tabs (any tab) - white flash

It is not always, but 90%

Bruce Tulloch

2012-02-23 22:36

reporter   ~0057046

Martin describes exactly the problem I am seeing. I'm using sawfish.

Martin Friebe

2012-02-25 16:40

manager   ~0057083

Last edited: 2012-02-25 16:40

lcl/include/ line 7120

procedure TWinControl.WMEraseBkgnd(var Message: TLMEraseBkgnd);
  if (Message.DC <> 0) and (wcfEraseBackground in FWinControlFlags) then
    Message.Result := 1;

Commenting out the call to EraseBackground does suppress the problem.
Of course this is NOT the solution, as it is for all (win)controls.

But it narrows down what happens.

I do not know, if a PageControl needs EraseBackground at all (if not it can overwrite the method).
I also do not know why on GTK it only happens under certain conditions, while on w32 it happens all the time


2012-05-17 17:36

reporter   ~0059680

This is a different problem than on Windows. On Windows when changing pages first WMEraseBkgnd is received but without wcfEraseBackground flag set. Message.Result is not set to 1 so Windows redraws the page with default brush. Then another WMEraseBkgnd is received with wcfEraseBackground set and window is repainted with the proper brush. If the color is different then we have flickering.

On GTK2 flickering starts happening after Screen.Cursor is changed. Maybe in the Editor there is a momentary cursor change when creating a new page.
This flickering did not happen with Lazarus
I can reproduce it on GTK 2.24.10, LXDE.

I have attached example project.
The TabCtrl and Page are custom classes, and they have disabled WMEraseBkgnd, EraseBackground and PaintWindow functions. TabCtrl color is red, Page color is yellow. It flickers with yellow, so with Page color not with TabCtrl color.

To reproduce:
1. Start project. Change the tabs - no flashing.
2. Press Change cursor button.
3. Change the tabs - now there's flashing.

2012-05-17 17:41



2012-05-27 12:32

reporter   ~0059992

The problem is in tab switching logic of TPageControl (at least for windows).
(Current and wrong implementation)Tab is switched by 2 notification messages (TCN_SELCHANGING and TCN_SELCHANGE)
1. On TCN_SELCHANGING current page is hided
2. On TCN_SELCHANGE new page is showed
So between this two messages there is gap where Page control does not have any visible page at all (so it flashes with its own background when painted).

Tab switching should be moved to single notification in TCN_SELCHANGE message.
And TCN_SELCHANGING message should be used only to report if tab can be switched (nothing should be changed in UI).

The same issue can be present on other platforms too.

Issue History

Date Modified Username Field Change
2012-02-23 01:44 Bruce Tulloch New Issue
2012-02-23 01:44 Bruce Tulloch Widgetset => GTK 2
2012-02-23 09:22 Zeljan Rikalo LazTarget => -
2012-02-23 09:22 Zeljan Rikalo Note Added: 0057016
2012-02-23 09:22 Zeljan Rikalo Status new => feedback
2012-02-23 11:26 Bruce Tulloch Note Added: 0057018
2012-02-23 12:06 Martin Friebe Note Added: 0057021
2012-02-23 12:33 Zeljan Rikalo Note Added: 0057022
2012-02-23 12:45 Bruce Tulloch Note Added: 0057023
2012-02-23 12:46 Bruce Tulloch Note Edited: 0057023
2012-02-23 17:08 Zeljan Rikalo Note Added: 0057032
2012-02-23 19:26 Martin Friebe Note Added: 0057041
2012-02-23 22:36 Bruce Tulloch Note Added: 0057046
2012-02-25 16:40 Martin Friebe Note Added: 0057083
2012-02-25 16:40 Martin Friebe Note Edited: 0057083
2012-05-17 17:36 cobines Note Added: 0059680
2012-05-17 17:41 cobines File Added:
2012-05-19 16:19 Martin Friebe Relationship added related to 0022080
2012-05-27 12:32 VitaliyG Note Added: 0059992
2014-10-02 11:01 Vincent Snijders Status feedback => acknowledged