Callback Stack

版本 1.2.0.0 (3.5 KB) 作者: Sebastian Hölz
Easy way to add multiple callbacks to objects, which support callback-functions (e.g. HG objects)
988.0 次下载
更新时间 2009/1/21

查看许可证

Handy function to add/remove/append an arbitrary number of callbacks to an object (e.g. figure, axes, line, patch, surface, text, image, zoom, pan, rotate, ...).

This function is extremely useful, if you write general purpose functions, which should be executed as object-callbacks without deleting any already existing callback(s).

A simple example can illustrate the functionality. Click on the current axis after executing each command:

CallbackStack(gca,'ButtonDownFcn','disp(''Hello'')') % Now click
CallbackStack(gca,'ButtonDownFcn',{@disp, 'World'}) % Click again
CallbackStack(gca,'ButtonDownFcn',{@disp, 'Hello'}) % ...
CallbackStack(gca,'ButtonDownFcn',{@disp, 'Hello'})
CallbackStack(gca,'ButtonDownFcn',{@disp, 'World'},'add')
CallbackStack(gca,'ButtonDownFcn',{@disp, 'World'},'remove')

This should give you an idea of how to add/append/remove callbacks to an object. OK, hope you find this useful. For further details have a look in the help contained in the file.

Sebastian

引用格式

Sebastian Hölz (2024). Callback Stack (https://www.mathworks.com/matlabcentral/fileexchange/21625-callback-stack), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.2.0.0

Revision 33:
- Better handling of different callback-styles (string, simple function handle, cell array).
- Removed some error-checking.
- New "add"-switch
- Bug-fixes.

1.0.0.0