|
|
Re: Problem with TreeView(uitree) and UIContextMenu
Posted:
Jan 30, 2013 3:16 PM
|
|
"Dennis B." wrote in message <kebca8$9f8$1@newscl01ah.mathworks.com>... > Hello Community, > > I have a small Problem setting up a my uiContextmenu for my TreeView(uitree): > > ------------------------------------------------------------------------ > Code: > > %Get Tree > JavaTree_ja = hMainDlgTree_ja.getTree; > > %Create Context Menu > hContextMenu = uicontextmenu('Tag','cmnu_TreeContextMenu'); > > ... > set(JavaTree_ja,'MouseClickedCallback','sc_maindlggui',hMainDlg,'mdtreenouseclick'}); > setappdata(JavaTree_ja,'UIContextMenu',hContextMenu); > JavaTree_ja.setRightSelectionEnabled(1); > > ------------------------------------------------------------------------ > > Because of using set-Function i get the Warning "MATLAB:hg:PossibleDeprecatedJavaSetHGProperty" (or "MATLAB:hg:JavaSetHGProperty" before Matlab 2012b). > But setappdata seems not working for this property. The contextmenu does not popup. > > Also i found no java-property for access JavaTree_ja directly. > > Anyone an idea to do this without warnings?
1. warnings - jObject = handle(JavaTree_ja, 'CallbackProperties'); set(jObject, ...)
2. getappdata - this was indeed removed for some inexplicable reason by MathWorks (I believe in R2012a). Use try/catch and/or the object's UserData or some other means of storing your data persistently. Bad, bad, MathWorks!
Yair Altman http://UndocumentedMatlab.com
|
|