Tree Widget Help

Serial Tree Help

Tree View

Help Index

Programming Help

Working with Serial Tree is easy! Please read the steps below for how to use the Serial Tree API.

How to create a Serial Tree Widget Window

Before creating a Serial Tree Widget Window you need to establish a serial communications connection to Omnia Creator first using the ILCore object. ILCore takes care of connecting to Omnia Creator using the fastest possible serial communications speed; that your microcontroller can run the Omnia Creator Interface Library code at so that you don’t have to worry about baud rates anymore.

With Omnia Creator, worrying about baud rates is a thing of the past!

Please note: you need to make sure that your serial port’s baud rate is set to Auto in Omnia Creator for the Omnia Creator Interface Library to work. You can also force your serial port’s baud rate to be another value in Omnia Creator for interfacing with devices that aren’t running the Omnia Creator Interface Library code.

To get started with Serial Tree, first include the Omnia Creator Interface Library in your code (line 1). Then declare the ILCore and ILTree objects (lines 3 and 4). In your main/setup function initialize communication with Omnia Creator using the core.init() function (line 8). core.init() takes care of setting up serial communications with Omnia Creator for you. Once you’ve initialized ILCore DO NOT USE YOUR NATIVE SERIAL FUNCTIONS ANYMORE! If you need to receive or send characters use ILCore to do it for you. ILCore wraps around your native serial port and supplies its own functions to access your native serial port like read, write, print, println, etc. However, if you still want to write/print to your native serial port, this is okay and will not cause any problems. Any text sent by your microcontroller will be printed to Omnia Creator’s standard serial terminal if you use your native serial write/print functions or ILCore’s write/print functions. But, you need to use the ILCore functions for receiving serial data. Calling your native serial read functions will cause the Omnia Creator Interface Library to lose synchronization with Omnia Creator.

Please note: you can use the ILCore object to open dialog boxes on the computer and get the results. You’re not going to really ever need to type into the serial terminal to command your microcontroller anymore!

Next, after initializing the core object you can clear all the previous Widget Windows from Omnia Creator’s memory by calling core.clearAll() (line 9). Any open Widget Windows should disappear after executing this line of code. If you don’t clear previous Widget Windows from memory you can still keep adding data to them from your microcontroller. However, you’ll need to clear a previous Widget Window from memory if you change the Widget Window’s type when you initialize it in your code. Omnia Creator’s Widget Menu also has a Remove Widget command and a Remove All Widgets command for this purpose. Omnia Creator will print out debug messages when there’s a problem that you need to address.

Finally, you can create the Serial Tree Widget Window by calling tree.init(&core, “Hello World”) (line 11). The first argument to tree.init() is a pointer to the core object. All you need to do is pass it &core always. Passing &core connects the child ILTree object to parent ILCore object. The second argument to tree.init() is a title string for the Widget Window. You can make this string whatever you want. But, please try to keep it short. If you’d like a docked Widget Window call the initDocked() function instead of the init() function. This will create the Serial Tree Widget Window as a docking window that can dock itself inside of the main Omnia Creator window. Otherwise the init() function will create the Serial Tree Widget as a top level window.

After executing this code a Serial Tree Widget Window should appear!

How to create Serial Tree Items

Once you’ve created your Serial Tree Widget Window you can now add items to your tree. The newItem() function creates a new item, the first argument is key path which can be any string. The second argument is the value which can be any string. All items that you create will be sorted by the key path and displayed in ascending order.

The key path is a slash (‘/’ or ‘\’) separated path.

How to create lots of Serial Tree Items

If you need to create a lot of items and want to set the text label for each item programmatically use the snprintf() function. snprintf() will allow you to create a formatted text string for each item.

Please note: some microcontrollers do not implement floating point support for snprintf(). If you see a ‘?’ in your text output where a floating point number should be then this is the case.

Other Things

After creating new items you can set their text again using the setItemValue() function; and get their text using the getItemValue() function. You can also delete items using the deleteItem() function. For bulk removal, call clearAll().

Have fun making trees with Omnia Creator!

User Interface Help

You can find information about user interface functions below:

Find Item

If you have a large tree and need to find some particular item text go to the File Menu and click Find Item. This will open a dialog where you can type in the item text to search for. Serial Tree will then highlight the first item found with the specified text and center the display on that item.

Export State

To export your tree state go to the File Menu and click Save Tree. This will export your tree state to a JSON file that you can open with Omnia Creator later to recreate your Serial Tree. Feel free to edit the exported JSON file.

Import State

To import your tree state go to the main Omnia Creator window, open the Widgets Menu and click Import Widget State. Select the JSON file you want to open and Omnia Creator will recreate the saved Serial Tree Widget Window for you.

Please note: the new Serial Tree Widget Window is a static read-only visualization of your data and is not connected to your serial port in any way.

Export CSV (comma separated values)

To export your tree state to a CSV file go to the File Menu and click Export CSV. This will export your tree state to a CSV file that you can open with programs like Microsoft Excel. Serial Tree will give you the option of including the column headers in the CSV file if you want them.

Copy Text

To copy text out of the Serial Tree Widget Window select and hover your mouse cursor over the cell you want to copy text from and press ctrl + c.