Stuart’s MATLAB Videos

Watch and Learn

uicontextmenu and ButtonDownFcn in MATLAB

When you use ButtonDownFcn in MATLAB, your callback is given an automatic input called hObject. This hObject is the handle of the object that you interacted with to invoke the callback, which makes it easy to define behavior based on the selected object. This is a little trickier when working with uicontextmenu, since the context menu itself is reported as the selected object. This video explains the behavior and shows one way to get the handle to the actual object the user selected. This is an advanced topic that assumes you know about callbacks and UiContextMenu.
|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.