How can I get a different values from a gui button, depending on if it's up or down?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Jan
el 9 de Mzo. de 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?
Respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!