matlab gui 怎么让 背景设置 与 editbox的输入前清空两个功能共存???

%原来我在OpeningFcn进行了
%窗口背景设置
ha=axes('units','normalized','position',[0,0,1,1]);
axis off
uistack(ha,'down')
BJ=imread('bj.jpg');
image(BJ);
colormap gray
set(ha,'handlevisibility','off','visible','off')
%然后在editbox的‘Enable’属性设为‘inactive’,添加buttondownfcn 进行
%设置输入清空(没有背景时可以实现输入清空)
set(hObject,‘String’,'','Enalbe','on');
uicontrol(hObject);
%结果变得无法输入怎么点都没反应,问题是怎么让两个功能共存???或有没有其他设置gui背景的方法??请各位高手帮忙解答, 3Q !

imshow产生的图片对象会捕获Mouse Click事件,要把其HitTest属性设置为off。

Response to captured mouse clicks, specified as one of these values:
    'on' — Trigger the ButtonDownFcn callback of the image. If you have defined the UIContextMenuproperty, then invoke the context menu.
    'off' — Trigger the callbacks for the nearest ancestor of the image that has a HitTest property set to'on' and a PickableParts property value that enables the ancestor to capture mouse clicks.

因此代码修改如下:

image(BJ);
改成 =>
fig = image(BJ);
set(fig, 'HitTest', 'off');

温馨提示:答案为网友推荐,仅供参考