Skip to content

How The Studio Visually Models Objects

A file can be visually modeled in the Visual Designer if the following conditions are met:

  • The file resides in the workspace’s make-path.
  • The file contains objects that can be visually modeled.
  • The file contains no modeling errors.

The file resides in the Workspace

If the file is not a member of the workspace, the Visual Designer view cannot be loaded for the file. If you attempt to load the designer, a message box error will appear explaining that the file is not a member of the workspace.

The file contains objects that can be visually modeled

Before a file is modeled, the Studio parses the file. As needed, it will also parse all files that this file uses and, if the file is a member of the current project, all files that are part of the current project. It uses this information to determine if the file can be visually modeled.

An object can be modeled if it is based on a class that supports visual modeling. Classes contain a meta-data tag named DesignerClass, which associates objects based on the class, or one of its subclasses, with designer classes known to the Visual Designer. When an association exists, the object can be modeled.

If a file can be modeled at all, one of its root level objects must be modelable. If the file does not contain any root level objects that can be visually modeled, the Visual Designer will display the message:

No Objects to Model

If the file does contain a root level object that can be visually modeled, that will be considered to be your “component” and that object and all of its children will be displayed. Only one component can be modeled in the Visual Designer, and that will be the first one encountered.

The file contains modeling errors

If certain errors exist in your file, the Visual Designer may decide that it cannot be modeled. When that happens, the Visual Designer will display a message that should help you find the problem. Also, when this occurs, the Problem Resolution panel can be used to locate problems.

Some of the conditions that can occur are:

Structural Errors

Some structural source code errors make it impossible for the Visual Designer to understand your code’s structure. Most of these types of errors are mismatched block command errors. For example, your code may contain an object command without a corresponding end_object command. If the Visual Designer encounters this anywhere within the file, it will not attempt to model the file until the errors have been corrected. The designer will instead display the message:

Source Code is not structured properly

File is not part of the current project

If your file is not part of the current project, it may or may not be modelable. If the file is not part of the current project and it contains any class (or superclass) that is not defined by the file or one of the files it uses, that file is considered to be incomplete and it will not be modeled. The designer will instead display the message:

File is not part of the current project

When this occurs, this can be remedied in one of two ways:

  • You can change the current project to a project that this file belongs to. The project may provide the missing class definition. Even if it does not, it can be modeled.
  • The better solution is to change your file so that the file or one of the files it uses provides all classes required for this file. This usually involves adding use statements to the file or one of the files it uses. This makes the file autonomous, which results in more robust (and modelable) components. The Problem Resolution panel can be used to locate problems.

Of Special Note

If a file is a member of the current project, the Visual Designer is more relaxed in its handling of unknown classes. If the class is unknown, the designer assumes that this is a real error that must be corrected, as the project cannot be compiled. It will still attempt to model your component but will skip objects derived from the missing class. The designer can do this because it knows how to accurately handle this certain error (it skips the object). When the same file is not part of the current project, it does not know how to handle what may or may not be an error.

It is therefore advised that you always model files that are part of the current project.

See Also