Detect a textbox content has changed
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi,
I’m trying to implement an "apply" bottom in a GUI, it function is to save the values of several textbox to variables used by another part of code. i want to disable the bottom when the user press it and enable it when the user modify the value of any textbox in the GUI. The problem is how to detect a change in the value of the objects to enable the bottom. Can anyone help me with suggestion on how to do this. Thanks in advance.
댓글 수: 0
답변 (1개)
Jatin Nanda
2016년 7월 27일
편집: Jatin Nanda
2016년 7월 27일
Hey Diego!
It seems that you want your app to perform different operations as a response to UI events that occur. Luckily, performing an action as a response to a change is the exact role of a call back function that can be attached to various UI components.
In MATLAB App Designer, you will notice that each component you drag onto the UIFigure will have properties shown on the bottom right of your screen. If you click on the 'CallBacks' tab, you will be able to enter a name for a custom callback function for each component. In your case, you would need to do this for each EditText/Button object that you would like to monitor for changes.
Once complete, you should be taken to the code-view of the application where you can write the implementation of the function you have just named. This is where you would save variables, disable buttons, or modify text as you see fit.
To see a full list of the operations you can perform on various components, check out the documentation: http://www.mathworks.com/help/matlab/components-in-app-designer.html
Hope that helps!
댓글 수: 1
Jatin Nanda
2016년 7월 28일
If you're not dealing with MATLAB App Designer, you can accomplish this call back function setting programatically through the uicontrol method in MATLAB. http://www.mathworks.com/help/matlab/ref/uicontrol.html
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!