create_button4tracking.m
来自「基于Matlab的地震数据处理显示和测井数据显示于处理的小程序」· M 代码 · 共 82 行
M
82 行
function button_handle=create_button4tracking(type_of_action)% Create a menu item to track cursor movements% Written by: E. R.: August 31, 2003% Last updated: January 8, 2004%% button_handle=create_button4tracking(type_of_action)% INPUT% type_of_action cell array or string with the call-back function to use for cursor tracking% presently options are:% {@display_cursor_location_2d,gca}% @display_cursor_location_3d% 'g_display_cursor_location_patch'userdata4button.on_off='off';userdata4button.button_action=type_of_action;figure_handle=gcf;set(figure_handle,'MenuBar','figure')%button_handle=uimenu('Label','Tracking is off','Tag','tracking_button', ...% 'ForeGroundColor',[0 0 1],'UserData',userdata4button);button_handle=uimenu('Label','Tracking is off','Tag','tracking_button', ... 'ForeGroundColor',[0 0 1]);setappdata(button_handle,'UserData',userdata4button)set(button_handle,'Callback',{@tracking,figure_handle})%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function tracking(hObject,evdata,figure_handle)% GUI tool% Written by: E. R.: August 31, 2003% Last updated: January 8, 2004: use function handle%% tracking(hObject,evdata,figure_handle)% INPUT% hObject handle of button% evdata reserved by Matlab% figure_handle handle of figure window% set(gcf,'MenuBar','none')% state = uisuspend(gcf);zoom offif isempty (hObject) % Window has no "tracking" button disp('No "tracking" button') returnenduserdata4button=getappdata(hObject,'UserData');if strcmp(userdata4button.on_off,'off')% zoom off userdata4button.on_off='on';% set(hObject,'UserData',userdata4button,'Label','Tracking is on'); set(hObject,'Label','Tracking is on'); set(figure_handle,'WindowButtonMotionFcn',userdata4button.button_action);% userdata4button.zoom_handles=disable_zoom(figure_handle)%test% zh=userdata4button.zoom_handles%test zoom offelse userdata4button.on_off='off';% setappdata(hObject,'UserData','userdata4button')% set(hObject,'UserData',userdata4button,'Label','Tracking is off'); set(hObject,'Label','Tracking is off'); set(figure_handle,'WindowButtonMotionFcn',[]); hh=findobj(figure_handle,'Tag','cursor_tracking_data'); % Find and remove the display delete(hh) % of the cursor tracking data% set(gcf,'menuBar','figure')% uirestore(state);% set(userdata4button.zoom_handles,'enable','on')end drawnowsetappdata(hObject,'UserData',userdata4button)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?