|
|
Re: Problem with TreeView(uitree) and UIContextMenu
Posted:
Jan 31, 2013 1:43 PM
|
|
"Dennis B." wrote in message <ked7t4$jp6$1@newscl01ah.mathworks.com>... > Hi Yair - thanks for your response. > After changing my Code to: > > ------------------------------------------------------------ > > jObject_ja = handle(JavaTree_ja, 'CallbackProperties'); > set(jObject_ja,'MouseClickedCallback',{'sc_maindlggui',hMainDlg,'mdtreenouseclick'}); > > setappdata(JavaTree_ja,'UIContextMenu',hContextMenu); %BARD-23-11-11: use "setappdata" for Java-GUI instead of "set" > > JavaTree_ja.setRightSelectionEnabled(1); %set(JavaTree_ja,'rightSelectionEnabled','on'); > > ------------------------------------------------------------ > > i get an error "Invalid object handle" at setappdata and if i change the order ("handle" and "set" at lastt) no error occurs, but also no Context-PopUp shows up. > > Any idea? > > Greetings > D.B.
Of course you get an error - read the documentation for set and setappdata - they are completely different. set is used to update an object's property (e.g., 'UIContextMenu'); setappdata is used to store some user-named value.
For a context menu to be active you need to *set* the UIContextMenu property; if you don't want the warning you need to set not the basic java object but the handle()'ed object. In short - you made a whole mess of things, so re-read my post carefully... (or my Matlab-Java programming book)
Yair Altman http://UndocumentedMatlab.com
|
|