0

I have a set of push-buttons in a figure designed in GUIDE and I want to assign one single function as their callback functions. But there is no combo-box to choose my function from in the property inspector, and when I select all buttons and click Callback from View Callbacks menu it creates multiple callback functions. Same behavior when I hit the I-DON'T-KNOW-WHAT-TO-CALL button in the property inspector.

I can handle this with some coding in OpeningFcn like what described here or just with calling set(handle, 'method'), but I really prefer to do it in the designing environment.

Community
  • 1
  • 1
saastn
  • 5,717
  • 8
  • 47
  • 78
  • 1
    Why can't you just type it in the Callback field in the property inspector? – sco1 Jul 01 '16 at 14:00
  • Your'e right @excaza, I should have tried that. I think I just expected something more convenient from such IDE. – saastn Jul 01 '16 at 14:15
  • 1
    @saastn In general, GUIDE is terrible at best. You get a lot more functionality/flexibility from writing a programmatic GUI. – Suever Jul 01 '16 at 14:26

1 Answers1

1

You can edit the Callback value within the Property Inspector. By default, it will be a custom callback for that uicontrol, but you can change it to be whatever you want.

enter image description here

So for me, for two push buttons they are something like the following by default:

@(hObject,eventdata)mygui('pushbutton2_Callback',hObject,eventdata,guidata(hObject))    
@(hObject,eventdata)mygui('pushbutton1_Callback',hObject,eventdata,guidata(hObject))

Just copy the value of one into the other and they will have the same callback.

Alternately, you can make them have a completely different callback by specifying your own value.

Suever
  • 64,497
  • 14
  • 82
  • 101