필터 지우기
필터 지우기

access to handles structure in WindowButtonDownFcn

조회 수: 1 (최근 30일)
Jim O'Doherty
Jim O'Doherty 2012년 2월 28일
Hello,
I've got a GUI, and I would like to be able to access the most up to date handles structure in the WindowScrollWheelFcn and WindowButtonDownFcn. Currently I can only access the handles structure as it has been set in my opening function.
At the moment I have the following opening function:
function openFile_ClickedCallback(hObject, eventdata, handles)
(other stuff happens here)
guidata(hObject, handles);
I then do some some other routines which change some of the variables stored in the handles structure (all functions with guidata(hObject, handles); at the end of them) and then have the following function which occurs on a mouse click:
function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
(other stuff happens here)
handles.startingPoint = get(hObject, 'CurrentPoint');
set(hObject,'WindowButtonMotionFcn',{@wbm, handles});
set(hObject,'WindowButtonUpFcn',{@wbu});
guidata(hObject, handles);
Am I missing something obvious to be able to access my most up to date handles structure in the above function? It seems to happen only with button related functions such as WindowButtonDownFcn and WindowScrollWheelFcn
Any ideas?
Thanks
Jim

답변 (1개)

Jan
Jan 2012년 2월 28일
You can update the handles dynamically:
handles = guidata(hObject)
or
handles = guidata(handles.hFigure)
if hFigure contains the handle of the figure.
  댓글 수: 1
Jim O'Doherty
Jim O'Doherty 2012년 2월 28일
Hi Jan,
I'm already updating dynamically at the end of every function to make sure I have the most up to date handles.
It seems to be just the mouse button click where my updated handles structure isn't appearing
Jim

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming Utilities에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by