Borrar filtros
Borrar filtros

Annoying issue using uidatepicker

5 visualizaciones (últimos 30 días)
Eduardo Salazar
Eduardo Salazar el 19 de Sept. de 2021
Comentada: Alexander Kramlich el 22 de En. de 2024
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 comentarios
Eduardo Salazar
Eduardo Salazar el 21 de Sept. de 2021
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 el 5 de Oct. de 2021
No one knows?

Iniciar sesión para comentar.

Respuesta aceptada

Amanda Irving
Amanda Irving el 14 de Oct. de 2021
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 comentarios
Eduardo Salazar
Eduardo Salazar el 3 de En. de 2022
Editada: Eduardo Salazar el 3 de En. de 2022
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 el 22 de En. de 2024
Didn't do the trick for me.
Is there a way to get a rid of this annoying tooltip altogether?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by