View Issue Details

IDProjectCategoryView StatusLast Update
0026106LazarusWidgetsetpublic2015-04-24 22:02
ReporterBart Broersma Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSLinux 
Product Version1.3 (SVN) 
Summary0026106: QT: Speedbutton incorrectly moves focus // Example SynEdit looses caret when clicking on a TSpeedButton
DescriptionIf you are in a SynEdit and then click on a TSpeeButton, the caret from SynEdit disappear.
You can only get it back if you set focus to another control control and the go back into the SynEdit (by mouse or by Tab).
Steps To ReproduceBuild attached App.
Click in SynEdit.
Click SpeedButton (it has no caption and does nothing).

Expected result: focus remains on SyEdit and Caret is unaltered
Observed result: focus remains on SynEdit, but Caret is gone.
TagsNo tags attached.
Fixed in Revision44923
LazTarget-
WidgetsetQT
Attached Files

Relationships

related to 0027960 closedZeljan Rikalo QT: 'External: SIGSEGV' on TDateEdit 

Activities

Bart Broersma

2014-05-04 14:40

developer  

focus.zip (2,839 bytes)

Vojtech Cihak

2014-05-04 14:50

reporter   ~0074756

Last edited: 2014-05-04 23:56

View 2 revisions

This has probably relation to 0024735.

Martin Friebe

2014-05-04 16:19

manager   ~0074759

Better subject

Bart Broersma

2014-05-04 18:20

developer   ~0074761

Does it actually remove focus?
If you add an OnClick handler for the speedbutton it says that SynEdit has focus (provided you were in Synedit1 to begin with).

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  i: Integer;
  C: TControl;
begin
  for i := 0 to Self.ControlCount - 1 do
  begin
    C := Self.Controls[i];
    if (C is TwinControl) then if TWinControl(C).Focused then writeln(C.Name,' has focus.');
  end;
end;

Martin Friebe

2014-05-04 18:26

manager   ~0074762

Last edited: 2014-05-04 18:26

View 2 revisions

SynEdit monitors
    procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
    procedure WMSetFocus(var Msg: TLMSetFocus); message WM_SETFOCUS;


So if it triggers WMKillFocus then it must return the focus with WMSetFocus

Bart Broersma

2014-05-04 20:08

developer   ~0074764

Placing some debug statements in TWinControl.WMSet/KillFocus and the same for TCustomSyEdit gives me this:

Press speedbutton when Edit has focus:
TWinControl.WMSetFocus A Edit1:TEdit
TWinControl.WMKillFocus A Form1:TForm1
TWinControl.WMKillFocus A Edit1:TEdit
//now the onClick of speedbutton


Press speedbutton when Memo has focus:
TWinControl.WMSetFocus A Memo1:TMemo
TWinControl.WMKillFocus A Form1:TForm1
TWinControl.WMKillFocus A Memo1:TMemo
//now the onClick of speedbutton


Press speedbutton when Button has focus:
TWinControl.WMSetFocus A Button1:TButton
TWinControl.WMKillFocus A Form1:TForm1
TWinControl.WMKillFocus A Button1:TButton
//now the onClick of speedbutton


Press speedbutton when SynEdit has focus:
[TCustomSynEdit.WMSetFocus] A
TWinControl.WMSetFocus A SynEdit1:TSynEdit
[TCustomSynEdit.WMSetFocus] END
TWinControl.WMKillFocus A Form1:TForm1
TCustomSynEdit.WMKillFocus A
TWinControl.WMKillFocus A SynEdit1:TSynEdit
TWinControl.WMKillFocus A SynEdit1:TSynEdit
TCustomSynEdit.WMKillFocus End
//now the onClick of speedbutton
TCustomSynEdit.WMKillFocus A
TWinControl.WMKillFocus A SynEdit1:TSynEdit
TWinControl.WMKillFocus A SynEdit1:TSynEdit
TCustomSynEdit.WMKillFocus End

In this case there seems to be an additional KillFocus _after_ the speedbutton' click?

Also TCustomSynEdit.WMKillFocus calsl inherited twice.
Not sure if that's by design or an oversight.

Bart Broersma

2014-05-04 23:42

developer   ~0074766

FWIW: under GTK2 there is no WMKillFocus from the control you were at before clicking the speedbutton.

Zeljan Rikalo

2014-05-05 09:31

developer   ~0074774

Seem that LCL does not like order of qt focus messages:
SetFocus
KillFocus
I've changed it locally to
KillFocus
SetFocus
and it seem to be ok now. I'll commit after heavy tests.

Zeljan Rikalo

2014-05-05 13:30

developer   ~0074779

Please test and close if ok.

Issue History

Date Modified Username Field Change
2014-05-04 14:40 Bart Broersma New Issue
2014-05-04 14:40 Bart Broersma File Added: focus.zip
2014-05-04 14:50 Vojtech Cihak Note Added: 0074756
2014-05-04 16:19 Martin Friebe Note Added: 0074759
2014-05-04 16:19 Martin Friebe Summary SynEdit on QT looses caret when clicking on a TSpeedButton => QT: Speedbutton incorrectly moves focus // Example SynEdit looses caret when clicking on a TSpeedButton
2014-05-04 18:20 Bart Broersma Note Added: 0074761
2014-05-04 18:26 Martin Friebe Note Added: 0074762
2014-05-04 18:26 Martin Friebe Note Edited: 0074762 View Revisions
2014-05-04 20:08 Bart Broersma Note Added: 0074764
2014-05-04 20:36 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-05-04 20:36 Zeljan Rikalo Status new => assigned
2014-05-04 23:42 Bart Broersma Note Added: 0074766
2014-05-04 23:56 Bart Broersma Note Edited: 0074756 View Revisions
2014-05-05 07:53 Zeljan Rikalo Status assigned => confirmed
2014-05-05 09:31 Zeljan Rikalo Note Added: 0074774
2014-05-05 13:30 Zeljan Rikalo Fixed in Revision => 44923
2014-05-05 13:30 Zeljan Rikalo Note Added: 0074779
2014-05-05 13:30 Zeljan Rikalo Status confirmed => resolved
2014-05-05 13:30 Zeljan Rikalo Resolution open => fixed
2014-05-07 12:32 Bart Broersma Status resolved => closed
2015-04-24 22:02 Jesus Reyes Relationship added related to 0027960