figure handle from uitree-javahandle

1 view (last 30 days)
Steffen
Steffen on 8 Sep 2011
hi there,
i use a gui that consists of different elements, that -lets say, they dont know each other. since they still need to communicate, they share data via the figure they are all nested in (setappdata/ getappdata). so far, everything works fine.
now heres the problem: one of the elements is a uitree, to which i added a context menu by implementing a mousePressed-callback, which is a property of the uitree-javahandle. now, when running the callback, there is obviously only the javahandle available, not the common handles-struct that you get in - lets call them GUIDE-callbacks :) to be precise its a javahandle_withcallbacks.com.mathworks.hg.peer.utils.UIMJTree.
so the question is: is there ANY way to get the figure handle from this javahandle?? (since i need the figure handle to share data). i tried gcf, but somehow it only returns 1 (which means a new figure) when called from within the callback.
EDIT: just found the TopLevelAncestor-property which return a com.mathworks.hg.peer.FigureFrameProxy$FigureFrame, which somehow must be the javaobject of the figure, but i still dont have a clue how to get the figure-handle :(
thanks in advance,
steffen

Answers (1)

Steffen
Steffen on 11 Sep 2011
ok, so at least i found out why gcf returned a new figure. it was hidden from within the callback. turning the root-property 'ShowHiddenHandles' on made it visible again, so this seems to work now :)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!