Effacer les filtres
Effacer les filtres

Problem with BottonDownFcn for a Pushbutton

2 vues (au cours des 30 derniers jours)
Salad Box
Salad Box le 23 Mar 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?

Réponse acceptée

Salad Box
Salad Box le 23 Mar 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...

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by