|
楼主 |
发表于 2007-11-29 09:48
|
显示全部楼层
是我表述的不购清除吗
我写个例子吧,我两次运行test,第一次 直接用鼠标点axes1,在edit中会显示hello, 第二次我点graph按钮Plot图形后再点axe1,edit中却没有反应。 我设置断点在"set(handles.edit1,'String','hello');"发现当显示plot图形后程序便跑不到这里来,因此就不会对edit有任何操作。 请问,我该怎么做才能在显示plot图形后还可以进行鼠标控制呢? 谢谢!
function varargout = test(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @test_OpeningFcn, ...
'gui_OutputFcn', @test_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function test_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = test_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
[file,path] = uigetfile('*.jpg');
axes(handles.axes1);
str = strcat(path,file);
[X,map] = imread(str);
imshow(X);
function axes1_ButtonDownFcn(hObject, eventdata, handles)
set(handles.edit1,'String','hello');
function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function pushbutton2_Callback(hObject, eventdata, handles)
axes(handles.axes1);
plot(1:100,sin(1:100)); |
|