Is it possible to extend graphics objects' functionality through inheritance?

3 views (last 30 days)
I extended the functionality of a line object using a class which takes a line handle as an input argument to its constructor. This class then creates a WindowMouseMotion listener to detect a mouseover the line which highlights the line and displays a panel containing controls for setting some line/data properties. This is working well.
I am now trying to make this class detect and respond to the line being deleted by listening for the line's ObjectBeingDestroyed event. My question is whether linking this class to the line object by storing the line's handle is the best solution or is it possible to extend the line class by inheriting from it? I have looked through the MATLAB documentation and searched online but can't find definitive information on inheriting from graphics classes.

Answers (1)

per isakson
per isakson on 26 May 2011
There is no documented way to inherit from (/subclass) handle graphic objects. I guess the rule is that if you cannot find it in the documentation it is not supported.
AFAIK, the solution you tried is the documented way to do it.
Are you aware of Undocumented Matlab ? You might find other solutions at that site.
- per

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!