Borrar filtros
Borrar filtros

Problem with BottonDownFcn for a Pushbutton

2 visualizaciones (últimos 30 días)
Salad Box
Salad Box el 23 de Mzo. de 2018
Respondida: Salad Box el 23 de Mzo. de 2018
Hi
I created a simple GUI like showing below.
What I would like to achieve is that when I click on the 'Start' button, it will 1) display 'hello' in the command window, and 2) the button will become invisible.
So firstly I wrote the code below to create an uicontrol which is a push button. Noticed that I set the 'ButtonDownFcn' of the push button to call another function 'clickObject'.
Then in the 'clickObject' function section I wrote the code below hoping that when I click on the button, 1) it will display 'hello' in the Command Window, and 2) the button will become invisible.
However, when I click on the button, nothing happens. The button is still there which I don't understand.
Can anyone help me please?

Respuesta aceptada

Salad Box
Salad Box el 23 de Mzo. de 2018
Just found the answer myself.
'ButtonDownFcn' is not suitable for 'pushbutton', rather I should use 'CallBack' instead.
So I have to change the line from 'ButtonDownFcn',@clickObject', to 'CallBack',@clickObject'.
Problem solved...

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by