Home > Applications > uiinspect > uiinspect.m

iFit/uiinspect

PURPOSE ^

uiinspect Inspect an object handle (Java/COM/HG) and display its methods/props/callbacks in a unified window

SYNOPSIS ^

function hFig = uiinspect(obj, fig)

DESCRIPTION ^

 uiinspect Inspect an object handle (Java/COM/HG) and display its methods/props/callbacks in a unified window

 Syntax:
    hFig = uiinspect(obj, hFig)    % hFig input argument is optional

 Description:
    UIINSPECT(OBJ) inspects an object handle (e.g., Java, COM, Handle
    Graphics, Matlab class, Dot-Net etc.) and displays inspection results
    in a Matlab figure window with all the relevant object methods (as can
    be displayed via Matlab's methodsview function), properties (as can be
    displayed via Matlab's inspect function), static fields and callbacks.
    UIINSPECT also displays properties that are not normally displayed
    with Matlab's inspect function. Property meta-data such as type,
    accessibility, visibility and default value are also displayed (where
    available).

    If the inspected object is an HG handle, then a component tree is
    displayed instead of the methods pane (see attached animated screenshot).

    Unlike Matlab's inspect function, multiple UIINSPECT windows can be
    opened simultaneously.

    Object properties and callbacks may be modified interactively within
    the UIINSPECT window.

    UIINSPECT(OBJ) reuses an already-displayed UIINSPECT window if its
    title is the same (i.e., same object or class); otherwise a new window
    is created. UIINPECT(OBJ,hFIG) forces using the specified hFig window
    handle, even if another window would otherwise have been reused/created.

    hFig = UIINSPECT(...) returns a handle to the UIINSPECT figure window.
    UIINSPECT creates a regular Matlab figure window which may be accessed
    via this hFig handle (unlike Matlab's methodsview function which opens
    a Java frame that is not easily accessible from Matlab).

 Examples:
    hFig = uiinspect(0);                         % root (desktop)
    hFig = uiinspect(handle(0));                 % root handle
    hFig = uiinspect(gcf);                       % current figure
    uiinspect(get(gcf,'JavaFrame'));             % current figure's Java Frame
    uiinspect(classhandle(handle(gcf)));         % a schema.class object
    uiinspect(findprop(handle(gcf),'MenuBar'));  % a schema.prop object
    uiinspect('java.lang.String');               % a Java class name
    uiinspect(java.lang.String('yes'));          % a Java object
    uiinspect(actxserver('Excel.Application'));  % a COM object
    uiinspect(Employee)                          % a Matlab class object
    uiinspect(?handle)                           % a Matlab metaclass object
    uiinspect('meta.class')                      % a Matlab class name
    uiinspect(System.Diagnostics.Process.GetCurrentProcess)   % a .Net object

 Technical explanation & details:
    http://undocumentedmatlab.com/blog/uiinspect/

 Known issues/limitations:
    - Fix: some fields generate a Java Exception, or a Matlab warning
    - other future enhancements may be found in the TODO list below

 Warning:
    This code heavily relies on undocumented and unsupported Matlab functionality.
    It works on Matlab 7+, but use at your own risk!

 Bugs and suggestions:
    Please send to Yair Altman (altmany at gmail dot com)

 Change log:
    2015-03-02: Fix for R2014a and older Matlab releases
    2014-11-21: Additional fixes for R2014b (HG2)
    2014-10-24: Fixed properties panel for .Net objects
    2014-10-24: Fixed a reported "invalid object handle" bug
    2014-10-20: Fixes for multiple edge cases
    2014-10-13: Fixes for R2014a, R2014b
    2013-06-30: Fixes for the upcoming HG2
    2013-01-25: Added context-menu option to export handle to workspace
    2013-01-23: Prevented intermittent crash reported for uiinspect(0); auto-expanded callbacks table if only one category; added hidden properties to the properties tooltip; updated FEX link in help; updated javadoc hyperlinks; fixed callbacks table
    2012-01-16: Fixes for R2012a
    2011-12-09: Fixed Matlab R2011b crash when inspecting COM object
    2011-06-14: Fixed problems with the Value field of the "Other properties" table for static fields
    2011-03-22: Fixed display of non-static Java class fields; fixed display of some cases of Java class names; minor fixes for Matlab class properties
    2011-03-03: Fixed several issues in the Value field of the "Other properties" table
    2011-02-28: Removed R2010b warning messages; minor fix for Dot-Net classes
    2010-11-02: Minor fixes for callbacks table; fixed online docpage for Swing classes
    2010-11-01: Major fix for pre-R2010 compatibility
    2010-10-20: Minor fix suggested by Andrew Stamps; added automatic callbacks grouping
    2010-06-13: Fixed download (m-file => zip-file)
    2010-06-11: Displayed class modifiers; improved performance; removed empty panels by default; fixed warning msgs when sorting props table; fixes for R2010b
    2010-03-18: Minor fix in copy-handle-value-to-clipboard (in tree context-menu)
    2010-03-17: Fixes for R2010a
    2010-01-16: Fixed a few bugs in properties meta-info of Matlab classes
    2009-10-23: Added CaretPositionChanged & InputMethodTextChanged to list of standard callbacks; minor fix to requesting focus of Java handles; minor fix to version-check display
    2009-05-22: Added support for Matlab classes (helped by Darik Gamble); improved display for classname input
    2009-05-20: Fixed methods info gathering for some handles
    2009-05-19: Improved information display for HG handles; added HG-handle screenshot to animated gif (added to COM, Java screenshots); enabled reuse of uiinspect window
    2009-05-04: Fixed setting callbacks on non-handle('CallbackProperties')ed Java objects; fixed input param edge-case; hyperlinked the className to Sun's Javadocs where relevant; auto-checked newer version; removed main menu
    2009-04-16: Fixed occasional endless loop upon callback update error
    2009-04-01: Fixed case of no methods (e.g., uimenus); fixed superclass/interfaces of classname input; auto-hide callbacks pane if no CBs are available
    2009-03-30: Added Extra method details checkbox (default=off); auto-hide inspectable checkbox if irrelevant; auto-sort methods by args list; hyperlinked classes; fixed title for classname inputs
    2009-03-14: Fixed string property value displayed; fixed display of Java classes added to the dynamic classpath; fixed display of classname static fields value; updated list of standard callbacks
    2009-03-05: Fixed single property edge-case; fixed prop name case sensitivity problem; fixed properties tooltip; accept class names; added display of class interfaces & static fields
    2008-01-25: Fixes for many edge-cases
    2007-12-08: First version posted on <a href="http://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect">MathWorks File Exchange</a>

 See also:
    ishandle, iscom, inspect, methodsview, FindJObj (on the File Exchange)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 26-Nov-2018 15:08:42 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1