Message in Response to Button Press
Mostrar comentarios más antiguos
Hi.
I'm working on a game where the player asks for a hint by pressing the 'h' key and getting hints as they go, so basically whenever they press on 'h' they get a new hint, how do I do that exactly?
3 comentarios
Jan
el 11 de Abr. de 2021
It depends. Are you creating a GUI with GUIDE, AppDesigner or programmatically with a figure or uifigure? Or are you working in the command window?
Ghina Alhunaidi
el 11 de Abr. de 2021
Editada: Walter Roberson
el 11 de Abr. de 2021
Walter Roberson
el 11 de Abr. de 2021
When you use inputdlg() then by default it creates a new figure for the interaction and it uses windowstyle 'modal'. The new figure does not have any key press callbacks you might have established, and the 'modal' does not return until the dialog is finished so you cannot activate any other window to allow the other window's controls to come into effect.
In theory you could deliberately tell it window style 'normal' instead of modal, and then in theory you could find the figure and inject callbacks into it so that pressing h coudl work. But the situation is not defined for that.
Respuestas (0)
Categorías
Más información sobre Number games 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!