Why does the right-click context menu appear at the bottom of my figure instead of at the mouse pointer location when zoom is enabled in MATLAB 7.0.1 (R14SP1)?

4 views (last 30 days)
I created a GUI in GUIDE containing a pushbutton that toggles the zoom of the axes in the figure. When the zoom is enabled and I right-click on the axes, the context menu appears at the bottom of the figure instead of at the location of the mouse pointer.
The following is my callback function for the zoom pushbutton:
function zoom_callback(hObject, eventdata, handles)
% This button toggles the zoom of the axes in the figure.
zoom

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in MATLAB 7.0.4 (R14SP2). For previous releases, please read below for possible workarounds:
We have verified that there is a bug in MATLAB 7.0.1 (R14SP1) in the way that context menus are displayed in some GUIs when right-clicking on the axes with zoom is enabled.
To work around this issue make the following changes to zoom.m:
1. Open zoom.m by typing the following at the command line:
edit zoom
2. Rename zoom.m to zoom_old.m in case there is a problem and you need to revert to the original version.
3. Make the following modification to zoom.m around line 327
After the call to
hui = localGetContextMenu(hZoom);
Replace the following three lines:
set(hui,...
'Position',get(hFigure,'CurrentPoint'),...
'Visible','on')
with the following four lines:
curr_point = get(hFigure,'CurrentPoint');
curr_pixel = hgconvertunits(hFigure,[curr_point 0 0],...
get(hFigure,'Units'),'pixels',hFigure);
set(hui,'Position',curr_pixel(1:2),'Visible','on')
4. Restart MATLAB
5. Execute the following command at the MATLAB command prompt:
rehash toolboxcache

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!