Pushbutton activated by Enter(return) key
Mostrar comentarios más antiguos
Hi,
I would like to ask you why doesn't work when I call funtion pushbutton1_Callback inside pushbutton1_KeyPressFcn. I have besidde other things buttons where I want them to react to Enter key when user Tabs to it (+ ofcourse when user just click at it). I thought that the simplest way would be to call pushbutton1_Callback in pushbutton1_KeyPressFcn,but obviously not...how caan I do this feature ?
Thanks, Peter
5 comentarios
Jan
el 31 de Oct. de 2012
Whenever you type "doesn't work" in the forum, it is a good idea to show the corresponding code and the error message. This would make suggestions for improvements much easier. A suggestion based on guessing, what you are doing, is usually very weak.
Petr
el 1 de Nov. de 2012
Editada: Image Analyst
el 1 de Nov. de 2012
Image Analyst
el 1 de Nov. de 2012
Editada: Image Analyst
el 1 de Nov. de 2012
Why do you not have handles? Are you using GUIDE or not? From the names of things it looks like you are. It looks like you didn't pay attention to my Answer.
Sean de Wolski
el 1 de Nov. de 2012
How are you running this GUI? Are you just double-clicking on the figure? You need to run the *.m file associated with the figure:
>>myGUI
Respuesta aceptada
Más respuestas (2)
Sean de Wolski
el 31 de Oct. de 2012
1 voto
You can do this, you just need to feed it the correct inputs. You could probably find these by looking in the property inspector in GUIDE at the callback to see what GUIDE is feeding it.
1 comentario
Petr
el 2 de Nov. de 2012
Image Analyst
el 1 de Nov. de 2012
Just put the inside of the click callback into its own function, like Button1Pressed() or something like that.
function handles=Button1Pressed(handles)
% whatever it does....
Then have the click and keypress callbacks both call Button1Pressed(). You don't need to pass in anything other than handles.
1 comentario
Petr
el 2 de Nov. de 2012
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!