Class Method Browser

When working with classes it is often useful to know what methods you can call on the object you’re working with. In most modern IDEs, this is easy as easy as pushing period. An auto-complete box will appear with all of the methods that you can call

Visual Studio 2013's auto complete on a String Object

Visual Studio 2013’s auto complete on a String object

This feature helps speed development, especially for unfamiliar classes. LabVIEW has Quickdrop, which is great, but still forces the user to be familiar with the classes. Also, Quickdrop searches a lot of places so if your class has a method like “Log.vi”, you’re going to have trouble finding it.

The VI I'm looking for is way down the list!

Using Quickdrop the VI I’m looking for is way down the list!

CMB Intro

Class Method Browser only shows the methods that you’re allowed to call on the selected wire

 

The MGI Class Method Browser is a Quickdrop-like window that filters the contents based on the class you have selected. All that you have to do is click on a wire(or tunnel, or terminal, etc) that contains a class, and then press the Class Method Browser shortcut (default Ctrl+C) and you’ll get a list of VIs that you can call on that wire. It will go up the inheritance tree to find methods, and it will filter out messages that you can’t call because of access scope restrictions!

 

Here’s an example to help explain.

+ is a public method, # is a protected method, - is a private method

UML for the example

Lets say you’re in a VI completely unrelated to the the classes shown to the right. You have a wire that contains the App class. This means that you’re allowed to call any of the public methods of the App class on that wire.
Click here to see what the Class Method Browser would look like

Now lets say you’re in Voice Recorder’s Run core.vi and you click on the wire that contains the Voice Recorder object. In this instance, you can call all public, private and protected methods of Voice recorder, as well as all public and protected methods of the App class.
Click here to see what the Class Method Browser would look like

The important thing to note here is that it goes all the way up the inheritance tree, so if your class inherits from a class that inherits from a class that inherits from a class…. it will find all of the method you’re allowed to call. Previously this would require a lot of navigating through the project.

Now for Actors….

First things first, an actor is a class, so viewing methods of an actor’s wire works just like every other class. A lot of time you don’t actually have an actor’s class wire though, you just have the enqueuer for it. This is because you’re sending it messages instead of calling methods on a class. So if you know you’re dealing with an actor, you can let Class Method Browser know by holding Shift when you press the Quickdrop shortcut. This will put the Class Method Browser in Actor Mode.

Sample Actor messages for the Logger Class

Sample Actor messages for the Logger Class

When in actor mode, instead of showing methods that you can call on a class, the Class Method Browser will display messages you can send to the actor. If you have an actor’s wire selected it will show you messages only for that actor. It will again go up the inheritance tree and find all messages you can send to that actor’s parent, and parent’s parent, etc. If you have anything else (or nothing selected) the Class Method Browser will show you all actor framework messages in the project.

The MGI Class Method Browser is compatible with LabVIEW 2012 and later. Click HERE to download the package.

Coming soon to the LabVIEW Tools Network