View Issue Details

IDProjectCategoryView StatusLast Update
0022079LazarusLCLpublic2012-05-26 21:20
ReporterJuha Manninen Assigned ToJuha Manninen  
Status closedResolutionno change required 
Product Version1.1 (SVN) 
Summary0022079: TCustomEdit OnEnter and OnExit are not always called properly
DescriptionI added DebugLns at r37350 for TCustomControlFilterEdit OnEnter and OnExit event handlers.
It is a known problem that the FilterEdit components sometimes keep the "(filter)" text when getting focus although the text should be cleared. See the related issue 0021689.
This happens on many widgetsets, at least GTK2 and QT.

The problem became even more visible with a new FilterEdit in Object Inspector.
Now for the first time I can reproduce it systematically!
It looks like OnExit call is first skipped when focus moves from FilterEdit directly to another form, for example to Designer in this case. After that also OnEnter is skipped when entering the FilterEdit next time.
If the focus stays inside one form, Object Inspector in this case, everything works fine.
For example moving between FilterEdit and component TreeView is OK.
Additional InformationTo reproduce:
- open a form with many controls in Designer.
- make cmd line visible so you can follow output from DebugLn.
- change focus between components FilterEdit in Object Inspector and different controls in Designer, by clicking them.
You will see how FilterEdit still has "(filter)" after getting focus, and how there are events missing before that.
TagsNo tags attached.
Fixed in Revision
WidgetsetGTK 2, Win32/Win64, QT
Attached Files


related to 0021689 resolvedJuha Manninen annoying option filter 
related to 0018962 closedJuha Manninen OnExit event not fired 
related to 0019722 resolvedBart Broersma TEditButton events are weird 


Zeljan Rikalo

2012-05-19 16:41

developer   ~0059754

I disagree about this problem.
1.TCustomEdit and any other controls SHOULD NOT trigger OnExit() when you select another form. When you select another form your TCustomEdit is still ActiveControl of it's parent form. When you activate your form again (eg. click on title), your TCustomEdit will be focused (it was all the time) - and that's fine.
2.If you wan't TCustomEdit to trigger OnExit in this case, then add Form.OnDeactivate handler and check there if your edit is focused, so trigger OnExit() or whatever.

Juha Manninen

2012-05-19 16:58

developer   ~0059759

Ok, now I understand the issue even more. When clicking a control in Designer, focus moves away from Object Inspector. Then Designer selects a node in Object Inspector's component tree. Focus moves out of FilterEdit but OnExit is not called, and no OnEnter either when it is clicked again.
I will see what I can do with Form.OnDeactivate.

Hans-Peter Diettrich

2012-05-19 16:59

reporter   ~0059760

I agree with Zeljan.

I don't see a relationship to 0019722, though, where the focus moves e.g. between the edit and button control.

Juha Manninen

2012-05-19 20:37

developer   ~0059767

I solved it by registering Form Activate and Deactivate handlers in FilterEdit to get info of ActiveControl state.
It works!

Issue History

Date Modified Username Field Change
2012-05-19 15:40 Juha Manninen New Issue
2012-05-19 15:40 Juha Manninen LazTarget => -
2012-05-19 15:40 Juha Manninen Widgetset => GTK 2, Win32/Win64, QT
2012-05-19 15:41 Juha Manninen Relationship added related to 0021689
2012-05-19 15:42 Juha Manninen Relationship added related to 0018962
2012-05-19 15:42 Juha Manninen Relationship added related to 0019722
2012-05-19 15:45 Juha Manninen Relationship added related to 0017942
2012-05-19 16:41 Zeljan Rikalo Note Added: 0059754
2012-05-19 16:58 Juha Manninen Note Added: 0059759
2012-05-19 16:59 Hans-Peter Diettrich Note Added: 0059760
2012-05-19 19:45 Juha Manninen Status new => assigned
2012-05-19 19:45 Juha Manninen Assigned To => Juha Manninen
2012-05-19 20:37 Juha Manninen Status assigned => resolved
2012-05-19 20:37 Juha Manninen Resolution open => no change required
2012-05-19 20:37 Juha Manninen Note Added: 0059767
2012-05-26 21:20 Juha Manninen Status resolved => closed
2012-05-26 21:30 Zeljan Rikalo Relationship deleted related to 0017942