Pressing Enter key in uiEditField does not call ValueChangedFcn after uiEditField.Value was changed programmatically
조회 수: 10 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Ritish Sehgal
2022년 10월 3일
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!!
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!