Code covered by the BSD License  

Highlights from
UIINSPECT - display methods-properties-callbacks of an object

5.0

5.0 | 14 ratings Rate this file 85 Downloads (last 30 days) File Size: 31.2 KB File ID: #17935
image thumbnail

UIINSPECT - display methods-properties-callbacks of an object

by

 

08 Dec 2007 (Updated )

Inspect an object handle (Java/COM/HG); display its methods/properties/callbacks in a unified window

| Watch this File

File Information
Description

Syntax:
hFig = uiinspect(obj)
 
Description:
UIINSPECT inspects an object handle (e.g., Java, COM, Handle Graphics, Matlab class, Dot-Net etc.) and displays the inspection results in a unified Matlab window. UIINSPECT displays a unified window with all 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 and fields that are not normally displayed with Matlab's inspect function. Property meta-data such as type, accessibility, visibility and default value are also displayed.

Unlike Matlab's inspect function, multiple UIINSPECT windows can be opened simultaneously.
 
Object properties and callbacks may be modified interactively within the UIINSPECT window.
 
hFig = UIINSPECT returns a handle to the created figure window. UIINSPECT opens a regular Matlab figure window which may be accessed via hFig (unlike Matlab's methodsview function which opens a Java frame that is not easily accessible from Matlab).
 
Examples:
hFig = uiinspect(0);
hFig = uiinspect(handle(0));
hFig = uiinspect(gcf);
hFig = uiinspect(handle(gcf));
uiinspect(get(gcf,'JavaFrame'));
uiinspect(classhandle(handle(gcf)));
uiinspect(findprop(handle(gcf),'MenuBar'));
uiinspect('java.lang.String');
uiinspect(java.lang.String('yes'));
uiinspect(actxserver('Excel.Application'));
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

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

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

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

Acknowledgements

Find J Obj Find Java Handles Of Matlab Graphic Objects inspired this file.

This file inspired Check Version Check For A Newer File Version On The File Exchange, Properties Gui Display Properties In An Editable Context Aware Table, Convert Objects To String, Check Class, Getundoc Get Undocumented Object Properties, Find J Obj Find Java Handles Of Matlab Graphic Objects, Figure From Text File (Supports Html Tags), and Programmatically Scroll Variables Editor.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (27)
23 Jun 2014 Lorenzo  
15 Apr 2014 Jon Griffiths  
28 Aug 2013 Emmanuel Farhi

Amazing work, which complements the built-in Matlab editor, but can also be used in compiled Matlab applications (mcc). Many thanks.

13 Jul 2013 Yair Altman

@Jonathan - you can simply click the arrow on the top of the split-pane divider.

Or you can modify line #378:
hsplitPane.setResizeWeight(0.6);
to some other value (e.g., 0.1) to make a permanent change.

12 Jul 2013 Jonathan Lister

Yair,
Is there a command/feature to cause the split panes to collapse such that the inspectable object properties pane is the only one immediately visible?

Thanks in advance.
Jonathan

23 May 2013 Martin Lechner  
24 Apr 2013 Paul Andrews  
13 Feb 2013 Mike

So far, I'm having just one problem. It keeps asking to update to most recent version (25-Jan-2013), even though it has already been updated. The actual file "modified" date is 22-Jan-2013.

28 Jan 2013 Andrew

I finally got around to downloading it after your latest post. Great work!

21 Jan 2013 Dan K

Yair,
I love your work, but the most recent version of this is crashing out on me:

uiinspect(0)
uiinspect: Dot name reference on non-scalar structure.
Error in uiinspect>getCbsPane (line 1080)
hModel = handle(callbacksTable.getModel, 'CallbackProperties');
Error in uiinspect>displayObj (line 323)
[callbacksPanel, cbTable] = getCbsPane(objCallbacks, false);
Error in uiinspect (line 128)
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);

Many thanks for your submissions, regardless.

Dan

17 Jan 2013 Yair Altman

@Johannes & @Henrik - the latest versions of uiinspect and findjobj that I uploaded a few days ago should have these issues fixed. They also have a few functional fixes/improvements, so it's worth downloading an update.

08 Jan 2013 Johannes Korsawe

Yair,
thanks for all your work.
I tried the latest versions of uiinspect(9.12.2011) and findjobj (25.7.2012) together and ended up with the following error:
>> hFig = uiinspect(0);
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1093
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1094
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1101
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1102
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getCbsPane at 902
In uiinspect>displayObj at 309
In uiinspect at 114
??? uiinspect: Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0
at java.awt.Container.getComponent(Unknown Source)
Error in ==> uiinspect>getPropsPane at 449
inspectorTable = inspectorTable.getComponent(0);
Error in ==> uiinspect>displayObj at 310
[propsPane, inspectorTable] = getPropsPane(objProps);
Error in ==> uiinspect at 114
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren,
inputname(1), fig);

My version:
-------------------------------------------------------------------------------------
MATLAB Version 7.11.0.584 (R2010b)
MATLAB License Number: XXXXXX
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------

Any help is appreciated.
Regards,
Johannes

22 Aug 2012 Emmanuel Farhi

Absoluytely incredible !! superbe work.

26 Sep 2011 Henrik Toft

I get following error when I try to use "uiinspect" in MATLAB R2011a. I have JUST downloaded the latest version on this page.

>> hFig = uiinspect(gcf);
Warning: Possible deprecated use of set on a Java object with an HG Property 'MousePressedCallback'.
> In uiinspect>getHandleTree at 1094
In uiinspect>getMethodsPane at 1023
In uiinspect>displayObj at 306
In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'MouseMovedCallback'.
> In uiinspect>getHandleTree at 1095
In uiinspect>getMethodsPane at 1023
In uiinspect>displayObj at 306
In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> In uiinspect>getCbsPane at 895
In uiinspect>displayObj at 307
In uiinspect at 112
??? uiinspect: Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0

at java.awt.Container.getComponent(Unknown Source)

Error in ==> uiinspect>getPropsPane at 446
inspectorTable = inspectorTable.getComponent(0);

Error in ==> uiinspect>displayObj at 308
[propsPane, inspectorTable] = getPropsPane(objProps);

Error in ==> uiinspect at 112
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);

>>
>> ver
-------------------------------------------------------------------------------------
MATLAB Version 7.12.0.635 (R2011a)
MATLAB License Number: ******
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.12 (R2011a)
Neural Network Toolbox Version 7.0.1 (R2011a)
Statistics Toolbox Version 7.5 (R2011a)
>>

Cheers,
Henrik

17 Aug 2011 Yair Altman

@Deng - I am not seeing the error that you reported. Please ensure that you are using the latest version of uiinspect. If you are using the latest version, please specify your system configuration as reported by the Matlab ver command.

03 Aug 2011 Changshun Deng

error:

hFig = uiinspect(0); % root (desktop)
??? uiinspect: Conversion to double from javahandle_withcallbacks.com.mathworks.hg.peer.UITreePeer is not possible.

Error in ==> uiinspect>getHandleTree at 1227
setappdata(tree_h, 'userdata',userdata);

Error in ==> uiinspect>getMethodsPane at 1162
paneContents = getHandleTree(obj);

Error in ==> uiinspect>displayObj at 318
[methodsPane, hgFlag] = getMethodsPane(objMethods, obj);

Error in ==> uiinspect at 124
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);

23 Mar 2011 Martin Lechner  
21 Mar 2011 Paul Andrews

Simply excellent. Thanks Yair

19 Oct 2010 Yair Altman

thanks Andrew - this will be fixed in the next update

19 Oct 2010 Andrew Stamps

To follow up my rating, I wanted to say that I have found this to be a very useful tool. However, I think I found a small bug: On line 773 where it is attempting to get property values to display the code currently reads:

if strcmpi(mp.SetAccess,'public')

For this to make sense, I believe it really should be:

if strcmpi(mp.GetAccess,'public')

29 Mar 2010 Yuri K  
09 Feb 2010 wma  
18 Jan 2010 Yair Altman

For anyone interested, UIInspect now supports:
- Handle Graphics (GUI) objects
- Matlab class objects (e.g., memmapfile)
- Custom (user-defined) class objects
- Java objects
- COM (ActiveX or server) objects

01 May 2009 Darik

what are the chances this could be extended to work with custom handle objects, i.e. classes that inherit from handle?

27 Mar 2009 Matthias Höller

Thanks for this very useful and sophisticated tool! Works great even with Java objects

12 Jun 2008 Brandon Baker

"Thank you for this excellent application" is what I meant to say.

12 Jun 2008 Brandon Baker

I love this program! What a nice way to ease myself into COM objects! Thank you for this excellent applications.

Updates
05 Mar 2009

Fixed single property edge-case; fixed prop name case sensitivity problem; fixed properties tooltip; now accepts class names - not just object handles; added display of class interfaces & static fields

30 Mar 2009

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

16 Apr 2009

Fixed case of no methods (e.g., uimenus); fixed superclass/interfaces of classname input; auto-hide callbacks pane if no CBs are available; fixed occasional endless loop upon callback update error

03 May 2009

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 figure main menu

19 May 2009

Improved information display for HG handles; added HG-handle screenshot to animated gif (added to COM and Java screenshots); enabled reuse of uiinspect window

26 May 2009

Added support for Matlab classes (helped by Darik Gamble); improved display for classname input; fixed methods info gathering for some handles

16 Jan 2010

Added CaretPositionChanged & InputMethodTextChanged to list of standard callbacks; minor fix to requesting focus of Java handles; minor fix to version-check display; fixed a few bugs in properties meta-info of Matlab classes

16 Mar 2010

Fixes for R2010a

11 Jun 2010

Displayed class modifiers; improved performance; removed empty panels by default; fixed warning msgs when sorting props table; fixes for R2010b

12 Jun 2010

Displayed class modifiers; improved performance; removed empty panels by default; fixed warning msgs when sorting props table; fixes for R2010b; fixed download (m-file => zip-file)

20 Oct 2010

Minor fix suggested by Andrew Stamps; added automatic callbacks grouping

01 Nov 2010

Major fix for pre-R2010 compatibility

02 Nov 2010

Major fix for pre-R2010 compatibility

28 Feb 2011

Removed R2010b warning messages; minor fix for Dot-Net classes; minor fixes for callbacks table; fixed online docpage for Java Swing classes

03 Mar 2011

Fixed several issues in the Value field of the "Other properties" table

08 Dec 2011

Fixed R2011b crash when inspecting COM; fixed problems with Value field in "Other properties" table of static fields; fixed display of non-static Java fields; fixed display of some cases of Java class names; minor fixes for Matlab class properties

14 Jan 2013

Fixes for R2012a+

25 Jan 2013

Added context-menu options to export handle to workspace; prevented intermittent crash reported for uiinspect(0); fixed and improved callbacks table; added hidden properties to the properties tooltip; updated help section

25 Jan 2013

Prevented intermittent error reported for uiinspect(0); added hidden properties to the properties tooltip; updated help section; updated javadoc hyperlinks; fixed and improved callbacks table

08 Jul 2013

Fixes for the upcoming HG2

Contact us