kapibara via Lazarus
2017-05-22 21:39:45 UTC
Is this a bug?
Simple demo: TEdit and TListBox are on a form. The TEdit is used to
rename selected string in the ListBox. The code for renaming is in the
Exit event of the TEdit. When an item in the ListBox is selected, the
Edit.Exit should fire and copy the Edit.Text to the current item in the
ListBox. The OnSelectionChange then copies the name of the selected
ListBox item to the TEdit.
This only works if selecting the already selected item in the ListBox.
If instead another Item is selected, the Edit.Text is overwritten before
it is copied to the old ListBox item: the ListBox.OnSelectionChange
fires before Edit.Exit.
ListBox.OnSelectionChange fires *before* both ListBox.Click and
Edit.Exit. I would expect Click to fire before SelectionChange? And
Edit.Exit before ListBox.Click, which it does, but only if
OnSelectionChange doesn't fire at all.
Clicking an item in the ListBox that is already selected results in the
same event order as in Delphi: Edit.Exit -> ListBox.Click.
Lazarus trunk, GTK2 Linux
There is an attached project.
Simple demo: TEdit and TListBox are on a form. The TEdit is used to
rename selected string in the ListBox. The code for renaming is in the
Exit event of the TEdit. When an item in the ListBox is selected, the
Edit.Exit should fire and copy the Edit.Text to the current item in the
ListBox. The OnSelectionChange then copies the name of the selected
ListBox item to the TEdit.
This only works if selecting the already selected item in the ListBox.
If instead another Item is selected, the Edit.Text is overwritten before
it is copied to the old ListBox item: the ListBox.OnSelectionChange
fires before Edit.Exit.
ListBox.OnSelectionChange fires *before* both ListBox.Click and
Edit.Exit. I would expect Click to fire before SelectionChange? And
Edit.Exit before ListBox.Click, which it does, but only if
OnSelectionChange doesn't fire at all.
Clicking an item in the ListBox that is already selected results in the
same event order as in Delphi: Edit.Exit -> ListBox.Click.
Lazarus trunk, GTK2 Linux
There is an attached project.