What is the difference between valuechangedfcn and valuechangingfcn?

9 vues (au cours des 30 derniers jours)
Some data entry window functions have the option to select a callback with options "valuechangedfcn" and "valuechangingfcn". I have used the valuechangedfcn callback to do something after the GUI user changes the value in that field. But, I don't know what valuechangingfcn is used for. Is that for doing something when a user clicks within the field and has not yet finished entering the new value, and the GUI would do something during that time? What would be an example?... Maybe pause an execution that is underway?

Réponse acceptée

Kevin Holly
Kevin Holly le 7 Juin 2022
Let's say it is a slider. "valuechangedfcn" would occur after you finished dragging the slider and let go on a new value. "valuechangingfcn" would occur while you are dragging the slider.
  3 commentaires
Kevin Holly
Kevin Holly le 7 Juin 2022
If you are dragging a slider with a left mouse button. Letting go of the left mouse button would end 'ValueChangingFcn' and trigger 'ValueChangedFcn' if it lands on a new value. So, I would say letting go of the mouse button you are holding down would "END" it.
Ranjan Sonalkar
Ranjan Sonalkar le 7 Juin 2022
Makes sense. Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

Matt J
Matt J le 7 Juin 2022
Modifié(e) : Matt J le 7 Juin 2022
Is that for doing something when a user clicks within the field and has not yet finished entering the new value, and the GUI would do something during that time? What would be an example?
Suppose you wanted to implement some sort of autocomplete feature. As the user types characters into an edit-text field, its valuechangingfcn can have a different edit box display suggested completions.
  2 commentaires
Matt J
Matt J le 7 Juin 2022
Modifié(e) : Matt J le 7 Juin 2022
Attached is a simple example app where as you enter text in one box, the valuechangingfcn prints it capitalized in another box. When you type enter (or click elsewhere on the app canvas) to finalize the text, the valuechangedfcn adds an exclamation point:
Lwando Mlindini
Lwando Mlindini le 1 Août 2022
Thanks a lot tha was helpfull@Matt J

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by