Filter löschen
Filter löschen

Problem with BottonDownFcn for a Pushbutton

2 Ansichten (letzte 30 Tage)
Salad Box
Salad Box am 23 Mär. 2018
Beantwortet: Salad Box am 23 Mär. 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?

Akzeptierte Antwort

Salad Box
Salad Box am 23 Mär. 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...

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by