From: Ahmad on
Hi there,

I have a GUI in which I display images. I want to make a tool which allows users to zoom into images, by dragging a rectangle over the axes (just like the tool provided with the default figure window in MATLAB). I wanted to know what is the best way to draw the rectangle over the axes which gets updated as the user's mouse moves ... or I have to write the callback for re-drawing the rectangle whenever the mouse moves?


thanks,
From: Steven_Lord on


"Ahmad" <ahmad.humyn(a)gmail.com> wrote in message
news:i3bonk$fe6$1(a)fred.mathworks.com...
> Hi there,
>
> I have a GUI in which I display images. I want to make a tool which allows
> users to zoom into images, by dragging a rectangle over the axes (just
> like the tool provided with the default figure window in MATLAB). I wanted
> to know what is the best way to draw the rectangle over the axes which
> gets updated as the user's mouse moves ... or I have to write the callback
> for re-drawing the rectangle whenever the mouse moves?

Why not simply use the built-in tool? Use the ZOOM function to toggle
whether zooming is enabled.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Ahmad on
Thanks Steven for the reply.

I wouldn't like having the whole menu bar for just the zoom tool. Is there a way to just a have the zoom button from the menu bar?

thanks again,


"Steven_Lord" <slord(a)mathworks.com> wrote in message <i3bper$2vk$1(a)fred.mathworks.com>...
>
>
> "Ahmad" <ahmad.humyn(a)gmail.com> wrote in message
> news:i3bonk$fe6$1(a)fred.mathworks.com...
> > Hi there,
> >
> > I have a GUI in which I display images. I want to make a tool which allows
> > users to zoom into images, by dragging a rectangle over the axes (just
> > like the tool provided with the default figure window in MATLAB). I wanted
> > to know what is the best way to draw the rectangle over the axes which
> > gets updated as the user's mouse moves ... or I have to write the callback
> > for re-drawing the rectangle whenever the mouse moves?
>
> Why not simply use the built-in tool? Use the ZOOM function to toggle
> whether zooming is enabled.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
From: Steven_Lord on


"Ahmad" <ahmad.humyn(a)gmail.com> wrote in message
news:i3brho$ha5$1(a)fred.mathworks.com...
> Thanks Steven for the reply.
>
> I wouldn't like having the whole menu bar for just the zoom tool. Is there
> a way to just a have the zoom button from the menu bar?

I never said you needed to add in the whole toolbar -- just create your own
button labeled "Zoom In" that calls the ZOOM function directly.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: George on
"Ahmad" <ahmad.humyn(a)gmail.com> wrote in message <i3brho$ha5$1(a)fred.mathworks.com>...
> Thanks Steven for the reply.
>
> I wouldn't like having the whole menu bar for just the zoom tool. Is there a way to just a have the zoom button from the menu bar?
>
> thanks again,

If you open your GUI in GUIDE go to the Tools menu and select Toolbar Editor. In the editor, i believe, you can choose which tools (zoom, pan, colorbar, etc.) you want in the toolbar.