Selection Events v. Focus Events - order is broken in JavaFX 8?
Tomas Mikula
tomas.mikula at gmail.com
Tue Feb 10 15:47:57 UTC 2015
Hi Scott,
whether that behavior is a bug in JavaFX 8 or not, why not commit on
focus lost *or* selection change? Less assumptions means more robust
code.
Regards,
Tomas
On Tue, Feb 10, 2015 at 10:15 AM, Scott Palmer <swpalmer at gmail.com> wrote:
> I have a custom field (my own formatted field done in JavaFX 2.2) bound to
> a property of the selected row in a TableView. My control commits an edit
> on focus lost.
>
> This works on JavaFX 2.2 but fails on JavaFX 8. After a bit of debugging I
> discovered why. The way to reproduce the problem was to type something into
> the field and then select a different row in the table. With JavaFX 2.2
> the edit is committed and then the control is populated with the data from
> the new selection. With JavaFX 8, the selection change event happens prior
> to the focus lost event, so my control's data is replaced without being
> committed.
>
> This smells like a rather serious bug in JavaFX 8. The TableView selection
> should not change as the result of a mouse click prior to the TableView
> getting the focus (and thus my control losing the focus and committing the
> edit to the selected item before the selection changes).
>
> Do you agree that this is broken behavior?
> Do you have an idea of how to work around it?
>
> Regards,
>
> Scott
More information about the openjfx-dev
mailing list