Project Options and fixing Errors in Embedded Source

This article reviews the essentials of the project system of Clarion 7, how it interacts with the application generator’s embed points, and the options that you have available to control or change the default behavior of the IDE.

Understanding these options will make you more efficient and productive in the Clarion 7 IDE.

We’ll start with an overview of the project system, discuss the origins of generated source code, and finish with the options available that control how you can edit errors in embeds when needed.


Controlling Source Generation

Regarding the action of building a program created with a Clarion application file, Clarion 7 is the most flexible IDE in the product’s history.

You can just generate source, generate source and make (build), and generate source, make (build), and then run the compiled program from the IDE.

Make (or Build) refers to the process of compiling and linking source to your output project target (EXE, DLL or LIB)

You can perform these actions from the Applications Pad, or from the IDE toolbar:


The highlighted IDE toolbar buttons shown in the above image are only enabled when an Application is opened for editing.

By comparison, the Applications Pad can affects all applications contained in the current Solution. How you process the Generate, Generate and Build, and Generate Build and Run button is controlled from the button drop list options:

Setting the Applications Pad to Generate Edited will perform the same actions as the buttons on the IDE toolbar.

And here is another important tip:

All buttons on the IDE toolbar and Applications Pad that display a “lightning bolt” will always affect the source generation of applications.

The following buttons (Build and Rebuild):


…do NOT cause the source code generation;  these buttons only run a “Build” against the source modules that already exists on disk.

The same fact; “Build does not cause the Application Generator to generate code” applies to all Build options selected from the Solution Explorer:



When bad things happen to good developers – Coding Errors

Let’s face it, stuff happens. The “stuff” that I’m referring to is errors in the source code that are generated from two basic sources of any application.

Code that is generated by the templates
We can break this down a little further. Since templates are read when loading an application, it is possible that something in your dictionary could cause bad code to be generated. Primarily this is from two areas of the dictionary; Triggers and Initial Values. A good tip here is to “mark” your code in the dictionary with a comment, like “DCT generated” or something like that.

You can also cause errors in the generated code by entering incorrect values in template prompts in the Application. Examples of this can be a bad Record Filter expression, incorrect or undefined variable names, etc. In most cases, when a template prompt is looking for data, you will be prompted by one of several selection dialogs (Select a File, Select a Key, Select a Column, etc.)

Code that is generated from embeds
Embeds allow developers to modify or extend the functionality of the base templates by adding additional source code. Clarion provides two views of embeds.

The Embed Editor is located in every procedure’s Embed tab. There is a hierarchical tree of entry points, and by default these embed points open a stand-alone editor that only applies to that selected embed point.



Embeditor (Source Context Editor)
The second view of embeds is the context view. In other words, how does your embed code fit in the context of the template generated code and other embed points? This is also called the Source Embeditor.

You can access the Source Embeditor in several ways:

Right-click on any procedure in the Application tree, and select Source from the popup menu, or press the Source Embeditor toolbar button as shown below:


From the Embeds tab:


…and if you’ve never seen it before, here is the Source Embeditor:



Putting it all Together
With what was just discussed above, let’s now put it all together.

When you press one of the options that generates source from the Application Generator…


…and the compiler detects errors, what source editor will be launched from the Errors Pad?

The options to control what source editor will open is controlled by settings in the Application Options.

To open the Application Options dialog, the application editor must be closed. Find this dialog and open it from the IDE Tools Menu (Tools > Application Options).

There are three settings in the Applications Options that control your editor options.

In the Application tab (the first tab you see when the Application Options is opened), find the following option:


When working in the application editor, this option should always be OFF if you want items from the Errors Pad to open up in your favorite embed editor.

With this option turned ON, ALL errors will always open the generated CLW source file, and if you edit errors and then later regenerate source from the Application Generator, your changes will be lost. Only use this option if you are simply testing or prototyping a coding scenario.

The next two options are found in the Application Options Embed Editor tab:

The Edit errors in context (using Embeditor) option will open the Source Embeditor by default from the Errors Pad when this option is checked. When unchecked, clicking on errors in the Errors Pad will open the Embed Editor by default.

Here is a VERY important point:

The Source Embeditor (or embed editor) will open ONLY if the error in the Errors Pad is caused by an EMBED error.

If the error is caused by bad dictionary information (like triggers or initial values), bad template entries, OR an embed that CAUSES bad GENERATED code (like a misplaced END statement), the error pad will ALWAYS open the CLW instead. So in nearly all cases except for the last one, when clicking on an error results in opening the CLW, you can be certain that the error is caused by an incorrect template setting or an error introduced in the Dictionary.

The last option, Edit source embeds in context by default (Using Embeditor), does not affect how errors are processed, but instead controls what editor to use when opening an embed in the Embed Tree found in the Embeds tab.

When it comes to handling coding errors in an efficient and productive manner, you need to know your project generation options in the Clarion 7 IDE, and know that errors can occur from two different application sources (templates or embeds), and ONLY errors from embed points will open the embed editor of your choice. The embed editor that you open (Embed Editor or Source Embeditor) is controlled by settings found in the Application Options window.

We recommend that you set the Edit embedded source errors in generated code option to OFF (unchecked) and the Edit errors in context (using Embeditor) to ON (checked). These are the default settings of a newly installed Clarion 7 IDE.

Happy programming!

2 thoughts on “Project Options and fixing Errors in Embedded Source

    1. Hi, Actually they do, but the toolbar buttons work more as the toolbar in C6 and the Application Pad allow to change the options on the fly.
      So the toolbar buttons are there to be always the same functionality and the Application Pad to do “one time” compilation/generation that don’t require the setting to be changed globally.
      The IDE Toolbar use the global options.

Comments are closed.