Annoying issue using uidatepicker

8 ビュー (過去 30 日間)
Eduardo Salazar
Eduardo Salazar 2021 年 9 月 19 日
コメント済み: Alexander Kramlich 2024 年 1 月 22 日
Hi
I'm facing an issue with the behavior from uidatepicker. I'm setting uidatepicker with
hDatePicker.DisplayFormat = 'dd-MMM-yyyy';
however this annoying tooltip keeps appearing
although after clicking away from focus, it sets to gracefully to
which is the format I'm asking it to follow from the get go. Think this is due to the LOCALE, which in my machine is en_US (hence why in the first case it insists in displaying it as MM-dd-yyyy) but there seems to be no way to change the locale such that the resulting application (compiled with application compiler) behaves consistently.
Any ideas?
  2 件のコメント
Eduardo Salazar
Eduardo Salazar 2021 年 9 月 21 日
Bump anyone?
The Q is this: although DisplayFormat has been set as 'dd-MMM-yyyy' it seems to revert to the locale format as default (ignores DisplayFormat altogether). Once the date is loaded in, it shows it as requested. In the process, it shows an "I" (information) message "reminding" me about the locale format, that I'm trying to override.
uidatepicker seems not to have a locale setting. If this is used for a compiled app, my idea is for it to basically obey the format issued as DisplayFormat (regardless of the locale of the machine the app is being used).
Any ideas?
Eduardo Salazar
Eduardo Salazar 2021 年 10 月 5 日
No one knows?

サインインしてコメントする。

採用された回答

Amanda Irving
Amanda Irving 2021 年 10 月 14 日
Eduardo,
The uidatepicker currently does not accept alpha characters as input. The idea is that not all end users will understand the local language and be able to easily substitute 'Feb' for 'Sep'. It caters towards the requirement that the user shouldn't be required to understand the language the date picker is using to successfully type a date.
You are right, when the DisplayFormat contains alpha characters, the input format defaults to a locale specific default supported by MATLAB's datetime object (English, Korean, Chinese, or Japanese).
If you change the DisplayFormat to include only numeric values, the input format will be consistent with the display format. Maybe that would help, but maybe that would make the date harder to distinguish across Europe and US conventions since the abbreviation for the month will no longer be spelled out.
d = uidatepicker();
d.DisplayFormat = 'MM/dd/yyyy';
Either way, you will get the tooltip. It's intending to remind the user what the format of the input is while they are typing.
What is the inconsistency you are seeing when deploying the app across locales?
  2 件のコメント
Eduardo Salazar
Eduardo Salazar 2022 年 1 月 3 日
編集済み: Eduardo Salazar 2022 年 1 月 3 日
Thank you and apologies for the delay in acknowledging your reply. Changing the format to dd-mm-yyyy (removing alpha characters in the display format) did the trick. It was a simple solution in the end; perhaps worth acknowledging that in the documentation? Many thanks again.
Alexander Kramlich
Alexander Kramlich 2024 年 1 月 22 日
Didn't do the trick for me.
Is there a way to get a rid of this annoying tooltip altogether?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by