MATLAB: Giving ‘Static Text’ a callback

callbackguitext;

I would like to give a 'static text' in a gui a callback. i.e i would like to be able to click on the static text box, and have that complete a command. Ideally, if there is a way i would like to make a callback for a right click only. Not sure if this is possible but any feedback helps.

Best Answer

In some ways similar to Andrew's suggestion:
You can set HitTest off for the static text box, and then you can define a ButtonDownFcn for the figure (or uipanel as relevant) that detects whether it is over the text and if so does what you want.
Alternately, perhaps defining a uicontext menu for the uicontrol would be suitable for your situation.