From: Sven on
Hi all, here's a similar post to my keypress question from a few minutes ago.

The following code will print "scrolled!" when the mouse wheel is rolled.

figure('WindowScrollWheelFcn','disp scrolled!');
axes
% ginput(1)

If you uncomment the last line, however, then click a point to feed to ginput, the 'WindowScrollWheelFcn' has been cleared.

Why?

Cheers,
Sven.
From: Sven on
"Sven" <sven.holcombe(a)gmail.deleteme.com> wrote in message <hu0th3$68o$1(a)fred.mathworks.com>...
> Hi all, here's a similar post to my keypress question from a few minutes ago.
>
> The following code will print "scrolled!" when the mouse wheel is rolled.
>
> figure('WindowScrollWheelFcn','disp scrolled!');
> axes
> % ginput(1)
>
> If you uncomment the last line, however, then click a point to feed to ginput, the 'WindowScrollWheelFcn' has been cleared.
>
> Why?

Well, the question of why has been answered a little here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283529

In the meantime, at least for the case of "ginput", the following will work to return all figure properties after being hijacked by ginput.

fp = get(gcf); fn = fieldnames(fp);
[xpt,ypt] = ginput(1);
for i=1:length(fn), try set(gcf,fn{i},fp.(fn{i})), end, end%#ok

Thanks,
Sven.