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!