Button Pressed Behavior control in App Designer.

24 visualizaciones (últimos 30 días)
Pappu Murthy
Pappu Murthy el 31 de Oct. de 2018
Respondida: Harini Naveela el 17 de Dic. de 2018
I created static text area with some text in an App using App Designer. I created a button when pressed makes the visibility of text to on. However, when I release the button the text area still shows up. I would like the text area to show up only when I am pressing button otherwise it should not be visible. How do i achieve this?

Respuestas (2)

Kevin Chng
Kevin Chng el 1 de Nov. de 2018
Editada: Kevin Chng el 1 de Nov. de 2018
Hi,
Initially, set text area to not visible. Refer to picture below.
Click TextArea component > Text Area Label & Properties (On your left bottom) > Configuration > Interactivity > Visible (untick)
Then in your button callback function
app.TextArea.Visible = 'on';
  6 comentarios
Kevin Chng
Kevin Chng el 5 de Dic. de 2018
Hi,
I'm not sure whether have you solve your problem. I realize there is keypress function which allow to do what you want.
12311.jpg
activate the function, then in the function, you may
app.TextArea.Visible = 'on';
Pappu Murthy
Pappu Murthy el 6 de Dic. de 2018
I have not solved my problem but your explnation I can not understand either. You have to be more specific and provide steps because the picture you provided is not much help to my eyes. Thanks.

Iniciar sesión para comentar.


Harini Naveela
Harini Naveela el 17 de Dic. de 2018
Hi,
Please try the below code:
% Button pushed function: Button
function ButtonPushed(app, event)
app.TextArea.Visible='on';
app.TextAreaLabel.Visible='on';
end
% Button down function: UIFigure
function UIFigureButtonDown(app, event)
app.TextArea.Visible='off' ;
app.TextAreaLabel.Visible='off';
end
end
The above code makes the text area visible on clicking the button, and makes it invisible on releasing (UIFigureButtonDown). Note that we can make the text area back to invisible only by triggering some event (UIFigureButtonDown in this case). You can use any other event according to your use case, but as far as I understood your requirement, I hope UIFigureButtonDown will be enough. Also, do not forget to switch off the vsibility of text area intially. See below:
app.TextAreaLabel.Visible = 'off';
app.TextArea.Visible = 'off';
Thanks,
Harini

Categorías

Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by