Detect a textbox content has changed

8 views (last 30 days)
Diego Perez
Diego Perez on 26 Jul 2016
Commented: Jatin Nanda on 28 Jul 2016
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.

Answers (1)

Jatin Nanda
Jatin Nanda on 27 Jul 2016
Edited: Jatin Nanda on 27 Jul 2016
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 Comment
Jatin Nanda
Jatin Nanda on 28 Jul 2016
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

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!