Button press emulation matlab

6 visualizaciones (últimos 30 días)
Namita Gera
Namita Gera el 5 de Abr. de 2022
Editada: Namita Gera el 12 de Abr. de 2022
Button press
  2 comentarios
Walter Roberson
Walter Roberson el 5 de Abr. de 2022
Do you need it to emulate clicking on a control that you have created, and no decoration is fine (activity is just triggered)? Or does it need to emulate mouse tracking and visible clicking on a control that you have created? Or does it need to emulate typing within the things you have designed? Or does it need to be able to interact with elements outside of what you have designed (e.g., controlling an external tetris game) ?
Adam Danz
Adam Danz el 6 de Abr. de 2022
@Namita Gera, in response to your PM, I would recommend what @Walter Roberson describes in the answer below. Pressing a button evokes the button's callback function. So each button should be assigned a callback function. You could either assign a different callback fcn to each button or assign the same callback fcn to all of the buttons and use inputs to decide which button was pressed.
There is an app testing framework that can simulate button presses but it would be much easier and more efficient to call the callback function directly. If you wanted to visually simulate the button-press so the user sees which button was selected, you could temporarily change the button color for 0.2 sec or so.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Abr. de 2022
Each button has an associated Callback property. To emulate pushing a button, have the program create a fake event structure (if needed) and call the stored Callback .
  8 comentarios
Walter Roberson
Walter Roberson el 8 de Abr. de 2022
eligible = find(ismember[app.Button_.Enable], "on"));
Namita Gera
Namita Gera el 11 de Abr. de 2022
Thank you very much worked in the end.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by