Effacer les filtres
Effacer les filtres

How can I get a different values from a gui button, depending on if it's up or down?

1 vue (au cours des 30 derniers jours)
Hello,
I'm new to matlab.
I'm creating a gui where I want a different value in a specific variable (say, buttonValue), depending on if the user is currently holding down a button or if they are not holding down that button.
I want to be able to do two things with this information.
1. run code only while it is pushed down (using an if statement, presumably)
2. be able to access the value of buttonValue in other parts of my code (using get(), presumably)
From what I've looked up, push buttons only cause a section of code to run; they can't store a value of up or down. Toggle buttons have to be pushed twice for their value to change. Neither of these seems to work for what I'm looking for.
Thank you, in advance, for your help.
edit: To be more clear:
While the left mouse button is held down over this button, buttonValue should equal 1.
While the left mouse button is not held down over this button, buttonValue should equal 0.
  2 commentaires
Jan
Jan le 9 Mar 2015
Toggle button do not have to be pushed twice to change their value. Thjere I do not understand, what you exactly want. What do you mean by "push"? Clicking with the mouse while the mouse is still down? Or is it enough if the event is triggered, when the mouse button is released?
Matlab_Learner
Matlab_Learner le 9 Mar 2015
Thank you for your response. To be more clear:
While the left mouse button is held down over this button, buttonValue should equal 1.
While the left mouse button is not held down over this button, buttonValue should equal 0.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by