Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5941017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:03:02+00:00 2026-05-22T16:03:02+00:00

I created a class which adds functionality to a figure on construction. This class

  • 0

I created a class which adds functionality to a figure on construction. This class creates a listener for the WindowMouseMotion event; however, to get this event to fire I had to add a dummy callback function for the figure’s WindowButtonMotionFcn property. I first check if this property is already populated. If it isn’t then I set it to a dummy callback function that does nothing.

Instead of checking if the property is already set or not, can I simply add this dummy callback to any existing callbacks? Is it possible for a callback property to call multiple functions?

EDIT

When using the handle.listener approach to handle the WindowButtonMotionEvent event given below, be sure to use eventdata.CurrentPoint to access the current mouse position. The CurrentPoint property of the figure does not get updated before handling the WindowButtonMotionEvent event in this manner.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:03:03+00:00Added an answer on May 22, 2026 at 4:03 pm

    A related article can be found on Yair Altman’s Undocumented MATLAB blog, from guest blogger Matt Whitaker. What you are alluding to is callback chaining, and quoting from the blog:

    Frankly, having written code
    previously that handles callback
    chaining, I would rather poke myself
    in the eye with a fork!

    Luckily, there appears to be an alternative solution in that article. Using a snippet from the code posted there, I was able to get a function to execute on mouse movement without having to set the 'WindowButtonMotionFcn'. I added a listener to the current figure like so:

    myListener = handle.listener(gcf,'WindowButtonMotionEvent',...
                                 @(hSource,eventData) disp('hello'));
    

    And the message hello was displayed when I moved the mouse in the window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a class which extends the JLabel class. This class essentially makes it
I recently created a class which has a constructor taking 3 enumerations as arguments.
I am using C#. I have created a class which can be included in
I am using the apache library. I have created a class which sends a
I've created a class library which exposes my back-end object model. I don't wish
I created a simple class in C++ which has a private dynamic array. In
I have created a class for a dashboard item which will hold information such
I have created a class library called AddServiceLibrary in which I have a method
Tearing my hair out. I created an as3 class - blah.Foo, which extends MovieClip.
I've created a custom module (which currently only defines a new Exception class), and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.