[REVIEW REQUEST] Committing ComboBox text input to the value property on focus loss

Jonathan Giles jonathan.giles at oracle.com
Wed May 23 16:08:51 PDT 2012


Kim,

For now, you're right, there is no feedback via any API (or visually) 
that input is invalid. This is definitely something I want to fix up in 
a future release, but I would rather it be a cross-control solution (so 
in other words, it needs more thinking time) :-)

-- Jonathan


On 24/05/2012 11:06 a.m., Kim Topley wrote:
> Is there any way for application code to discover this and let the 
> user know? Otherwise, how will the user see a difference between valid 
> input (accepted) and invalid input (not accepted)? Won't the 
> appearance be the same in both cases?
>
>
> On Wed, May 23, 2012 at 6:56 PM, Jonathan Giles 
> <jonathan.giles at oracle.com <mailto:jonathan.giles at oracle.com>> wrote:
>
>     In both cases, assuming invalid input is put into
>     StringConverter.fromString(String), and we signal this by
>     returning null, the value property is not changed, and the text
>     typed into the ComboBox remains as it was - with the invalid input
>     still in place.
>
>     Ideally in a future release when we have validation support this
>     would be the point where the ComboBox would indicate an invalid
>     input has been received (most probably due to a typo or a user
>     trying their luck with invalid input).
>
>     -- Jonathan
>
>
>
>     On 24/05/2012 10:51 a.m., Richard Bair wrote:
>
>         OK, so:
>
>         User types invalid input, hits enter. What happens?
>         User types invalid input, tabs out. What happens?
>
>         Cheers
>         Richard
>
>         On May 23, 2012, at 2:54 PM, Jonathan Giles wrote:
>
>             Hi all,
>
>             The jira issue for the runtime bug is here:
>             http://javafx-jira.kenai.com/browse/RT-21454
>             The jira issue for Scene Builder is here:
>             http://javafx-jira.kenai.com/browse/DTL-4415
>
>             I'm hoping to make a slight behavioural change to ComboBox
>             in 2.2 so that it acts in a more useful manner. Currently,
>             in an editable ComboBox, the value property is only set
>             when the user presses Enter. What RT-21454 asks for is
>             that the value property also be updated when focus is lost.
>
>             If we don't make this change, the form developer has to
>             consider either forcing an event to commit the value, or
>             getting the ComboBox editor (which is new API in 2.2), and
>             retrieve the text out of there. Of course, this will burn
>             every developer until they test their form and realise the
>             value property is not set.
>
>             Therefore, I would like to make a small change to ComboBox
>             such that whatever the user has typed when focus is lost
>             becomes the new ComboBox value (assuming it is legal input
>             to the StringConverter). There is a patch attached to the
>             runtime jira above which makes this change, but does not
>             change any API: this is purely a behavioural change to
>             make ComboBox more useful.
>
>             Thanks,
>             Jonathan
>
>


More information about the openjfx-dev mailing list