why does pushing buttons affects my GUI?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a code that originaly started working (counting spacebar taps) as it should,without the need to press the mouse buttons before. like in this code suggested by Jarrod Rivituso- http://www.mathworks.com/matlabcentral/answers/47698-how-to-count-key-presses-in-limited-time
now, after I have added a few text UIconrols and buttons to my GUI, somehow when it returns to the main figure and I press the space key nothing happens.
only after pressing with the mouse buttons inside the figure area, the GUI will start counting as soon as I press the spacebar. my code can be seen in this link- https://docs.google.com/document/d/1-Jegvum5IQKZZBeyKqmVmQa0wvKG4QgAqoYochbS8Jk/edit
how can I change it so that I won't have to press a mouse button before the spacebar presses?
0 commentaires
Réponse acceptée
Matt Fig
le 11 Oct 2012
You might want to use the WindowKeypressfcn instead. Having said that, you might want to consider your overall design. Part of designing a GUI is making it so that the user can tell what to do and errors are minimized. If I run your GUI, I can see you want me to enter a number, but it is not clear where. If you put this line in your code after all the uicontrol creation:
uicontrol(a4)
Then the editbox will be blinking at startup. This makes it intuitive. Then you might want to consider that when the user hits return after entering the number, another instruction becomes invisible telling them to begin hitting the spacebar, or whatever.
5 commentaires
Jan
le 11 Oct 2012
Modifié(e) : Jan
le 11 Oct 2012
@Walter: See FEX: uiFlash. Useful for e.g.: A GUI with more than 5 elements (edit fields, popups etc) and a "Start" button. The user can apply the selections in arbitrary order. When the Start button is pressed, the consistency of the selections is checked and conflicting UI-controls are high-lighted.
Plus de réponses (0)
Voir également
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!