Debugging

Debugging a Component

This section describes the process of debugging the C++ part of your JavaScript Component.

  

Windows

Make sure you set your build configuration to the UNICODE DebugWebDesign target.

image1

Open your project's Properties.

Start debugging (F5). Omnis will be launched with your new component, and any breakpoints in your code will be hit.

  

Mac

The first step in debugging an OS X component, is to edit the scheme.

image2

The next step is to make sure that your component is built into the Omnis tree.

image3

You can now Run your project. Omnis will be launched, and any breakpoints in your code will be hit.

Debugging a Control

This section gives a simple overview of debugging a JavaScript Control, the JavaScript part of your component.

In order to debug JavaScript code, you need to make use of the debugging tools in your browser. Most of the major browsers have their own implementation for this. This document is based on using Chrome (since its debugging tools are very good), but the principles hold true for all browsers.

Viewing the DOM Structure

The first, and simplest, debugging procedure is to take a look at the structure of your control. This allows you to make sure that the elements are being constructed as you wish.

image4

 

Stepping Through Code

Another very useful debugging feature is the ability to step through your code.

Load your Omnis form in Chrome, then open the developer tools (F12 / Cmd-Alt-I). Alternatively you can right-click some element on the form and Inspect element.

Switch to the Sources tab, and select your .js file from the scripts folder shown in the source tree.

image5

This will bring up your source code, and allow you to set breakpoints (by clicking in the margin).

When you hit a breakpoint, you can view the values of variables by simply hovering over them with the mouse, or in the developer tools sidebar.

image6