MATLAB Answers

What events are available to add a listener to for uicontrol objects? (specifically push button)

24 views (last 30 days)
Will Grant
Will Grant on 8 Nov 2012
I have successfully added listeners for property changes with a popup menu via:
listener = addlistener(popupH, 'Value', 'PostSet', @testFcn2);
and for seeing user interaction with the figure containing the controls:
listener = addlistener(fh, 'WindowButtonDown', @testFcn);
etc from the documentation page Matlab > Graphics > Graphics Objects > Object Property Operations > "Callback Properties for Graphics Objects" and just deleting the 'Fcn' from the properties to get the event name.
But now I want to look more into responding to events of particular ui controls. I tried the following for a push button:
listener = addlistener(buttonH, 'ButtonDown', @testFcn);
but I get the error "The specified event is not supported by the object". So then I thought, I will just figure out which events a uicontrol object publishes. So I managed to get a real reference to the uicontrol push button object by successfully adding a listener to one of the property changes, breakpointing within my @testFcn, and calling
events(eventData.AffectedObject)
but it said "No events for class uicontrol".
Can someone shed some light on this for me? I just want to figure out how to look at the event names exported by ui controls.
Thanks! Will

  0 Comments

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by