Why am I unable to set the "UIContextMenu" property of my uicontrol back to "None" using the Property Inspector in MATLAB 6.5 (R13)?

3 views (last 30 days)
For example, if I set the "UIContextMenu" property of my pushbutton to some context menu I created using the Menu Editor in GUIDE, and then try going back to "None", I receive the following error in the MATLAB Command Window:
"Exception while setting the value"
The "UIContextMenu" property value in the Property Inspector remains the same.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This is a bug in MATLAB 6.5 (R13) in the way that GUIDE handles setting property values using Property Inspector. Our development staff is investigating this issue.
Currently, to work around this issue, try setting the "UIContextMenu" property of your uicontrol to [] in the "OpeningFcn". For example:
function test_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
set(handles.pushbutton1,'UIContextMenu',[])
guidata(hObject, handles);
Alternatively, you can also use the following workaround:
1. Create a new context menu in the Menu Editor.
2. From the Property Inspector, set the "UIContextMenu" property to the new context menu.
3. In the Menu Editor, delete the new context menu by highlighting it and then clicking on the trash can icon.
4. In the Property Inspector, you will see the "UIContextMenu" has been reset to "None".

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!