简体   繁体   English

如何在不单击确认按钮的情况下设置Jfxtras LocalDateTimeTextField值?

[英]How to set Jfxtras LocalDateTimeTextField value without click confirm button?

I click localeDateTimeTextField and pop-up open. 我单击localeDateTimeTextField并弹出打开。 I select a different value from default. 我选择了与默认值不同的值。 When I click any other space, pop-up close, but not set value which I select. 当我单击任何其他空格时,弹出窗口关闭,但没有设置我选择的值。 I want to set my localeDateTimeTextField component value without click confirm button when I close it. 我要设置我的localeDateTimeTextField组件值,而在关闭它时不单击确认按钮。

Is there a pop-up close action for set value which I choose from pop-up on close action? 我可以从关闭操作的弹出窗口中选择设定值的弹出关闭操作吗? or any other way? 或其他方式?

dtSpecificDate = new LocalDateTimeTextField();
    dtSpecificDate.withLocalDateTime(LocalDateTime.now());//
    dtSpecificDate.setMaxWidth(170.0);
    dtSpecificDate.setDisable(true);
    dtSpecificDate.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"));
    gridRadioGroup.add(dtSpecificDate, 1, 1);

When setting the datetime, there are multiple controls that can be changed in the popup, so there needs to be an official "accept what is set now" moment. 设置日期时间时,在弹出窗口中可以更改多个控件,因此需要正式的“接受现在设置的”时刻。 That is the ok button. 那是确定按钮。 The question of course is what to do when the popup is closed because you click outside. 当然,问题是当您单击外部时,关闭弹出窗口时该怎么办。 In this case the input is not accepted, and that is your problem. 在这种情况下,输入不被接受,这就是您的问题。

Thus the answer to your question is: no (not at the moment). 因此,您的问题的答案是:不(目前不)。

But if you have a good use case for your behavior it can be added, of course. 但是,如果您对自己的行为有一个很好的用例,那么可以添加它。 "AcceptValueOnClose" would be an option, but I'm not too exited about that approach. “ AcceptValueOnClose”将是一个选项,但我对这种方法不太满意。 Can you tell a bit about why you need that? 您能说说为什么需要它吗?

An alternative behavior would where the value is continuously updated with every UI interaction. 一种替代行为是,每次UI交互都会不断更新该值。 Basically that is what the CalendarPicker does as well, it does not have an ok button. 基本上,这也是CalendarPicker的功能,它没有确定按钮。 That would be more acceptable to me, but then the application needs to provide an undo option. 这对我来说将是更可接受的,但是应用程序需要提供一个撤消选项。

Would a continuous update be an acceptable solution for you use case? 对于您的用例,连续更新是否可以接受?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM