Azzera filtri
Azzera filtri

Problem with BottonDownFcn for a Pushbutton

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Salad Box
Salad Box il 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...

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by