User's Guide

Classifying scripts

You can classify scripts as public or private, or as class methods or instance methods.

Public and private

By convention, scripts marked public can be used freely by other scripts in other classes. Scripts marked private should only be used by scripts in the same class because they are subject to change. This is only a convention and not a rule that is enforced.

To see which scripts are public or private, use the public/private push button. This push button is a toggle. When you select it, the label changes to private. When you select it again, the label changes back to public. When the label is public, only public scripts are shown in the list. When the label is private, only private scripts are shown in the list.

When you save a script, it is marked either public or private, depending on the current label of the push button.

After a script is created, you can change its classification by selecting the script and selecting Change Public/Private from the Methods menu.

Class and instance

The scripts that you write for script connections are called instance methods, because every instance of your visual part understands the messages that these methods implement.

The class that defines the visual part can also have scripts, which are called class methods, because only the class definition itself can understand the message that calls these methods.

Use the instance push button to toggle between creating instance and class methods. When you save a script, it is marked either instance or class, depending on the current label of the push button. When the label is instance, only instance methods are shown in the list. When the label is class, only class methods are shown in the list.

Most of the methods you create as a new user are instance methods. Class methods become important when you begin creating reusable parts.

Comments and notes

When you select the source push button in the bottom right-hand corner of the Script Editor, the label of the button changes to comment, and the text area shows the comments for the script. Comments provide information useful for users of a class. When you select the button again, the label of the button changes to notes, and the text area shows any notes for the script. Notes provide information that the maker of the class doesn't want to forget. Select the button a third time and the text area shows the source for your script again.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]