source: trunk/src/mouse_alt_gui.m @ 271

Last change on this file since 271 was 252, checked in by sommeria, 13 years ago

various bugs corrected.

File size: 1.6 KB
Line 
1%'mouse_alt_gui': function activated when the right mouse button is pressed on a GUI (callback for 'WindowButtonDownFcn')
2% it displays a msg box with zoom of the current uicontrol display
3%------------------------------------------------------------------------
4function mouse_alt_gui(hObject,eventdata,handles)
5%------------------------------------------------------------------------
6if isequal(get(hObject,'SelectionType'),'alt')
7    set(hObject,'Units','pixels')
8    series_pos=get(hObject,'Position');%position of the current GUI  (in pixels), as selected by the mouse
9    set(hObject,'Units','normalized')
10    xy_fig=get(hObject,'CurrentPoint');% current point of the current GUI
11    hchild=get(hObject,'Children');%handles of all objects in the current GUI
12    %% loop on all the objects in the current figure (selected by the last mouse click)
13    for ichild=1:length(hchild)
14        obj_pos=get(hchild(ichild),'Position');%position of the object       
15        if numel(obj_pos)>=4 && xy_fig(1) >=obj_pos(1) && xy_fig(2) >= obj_pos(2)&& xy_fig(1) <=obj_pos(1)+obj_pos(3) && xy_fig(2) <= obj_pos(2)+obj_pos(4);         
16            htype=get(hchild(ichild),'Type');%type of object child of the current figure
17            %if the mouse is over a uicontrol, look at the data
18            if isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on')
19                msg_pos(1:2)=series_pos(1:2)+obj_pos(1:2).*series_pos(3:4);
20                msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos)
21                break
22            end
23        end
24    end
25    set(hObject,'Units','pixels')
26end
Note: See TracBrowser for help on using the repository browser.