Pressing Enter key in uiEditField does not call ValueChangedFcn after uiEditField.Value was changed programmatically
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Inside uiFigure GUI, when you press Enter key with focus on ef = uiEditField, ef.ValueChangedFcn is called.
But this only happens if the ef.Value was changed by typing something in ef.
If I change ef.Value from program, e.g. ef.Value = "new", then pressing Enter key does nothing. It seems the MATLAB does not know the value was changed. I have to type an additional character, and then pressing Enter key works, and calls ef.ValueChanged
Is there a way to let MATLAB know that the value was changed and that it must accept Enter key?
0 comentarios
Respuestas (1)
Ritish Sehgal
el 3 de Oct. de 2022
It is my understanding that you want to trigger ValueChangedFcn callback after setting the uiEditField.Value programmatically.
As per my understanding, these callback functions are only triggered when the value of edit field is changed in the UI, not programmatically.
You can create a wrapper function which sets the value of the edit field and then you can manually call the ValueChangedFcn.
Please refer to the MATLAB answers link below which discusses a similar issue and a sample wrapper function that can be useful to you.
Hope it helps!!
Ver también
Categorías
Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!