Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Problem with TreeView(uitree) and UIContextMenu
Replies: 6   Last Post: Feb 6, 2013 9:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Yair Altman

Posts: 1,347
Registered: 3/19/07
Re: Problem with TreeView(uitree) and UIContextMenu
Posted: Jan 31, 2013 1:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.