Tools and Extensibility

PDF Print E-mail

Lianja App Builder comes with a whole host of built-in functionality "out of the box". There are occasions however where developers have a requirement to integrate external tools (e.g. git) or build themselves an "App Generator Wizard" or similar tools.

The ability to extend Lianja App Builder with custom tools is simple and straightforward. Tools can be written in any of the supported scripting languages; Visual FoxPro, Python, PHP or JavaScript and they can utilize all of the Lianja App Framework classes and work with the internals of the Lianja App Builder through the Lianja Object Model.

It is not the objective of the Lianja Development Team to provide everything for all men (or women) but rather to provide a core technology that professional developers can extend to their heart's delight. You can consider Lianja App Builder as a meta-framework which you can extend to satisfy your own personal development requirements.

In this short article I will show you how to build a "Custom Tool" and how to have it loaded into Lianja App Builder when you run it.

When the Lianja App Builder loads, it loads custom tools from the "tools" folder in the main lianja folder. On Windows for example this is located in C:\Lianja\tools. (on Linux it can be found in /opt/lianja/tools).

The "Google Chart Wizard" that you see when you switch to the "Tools" workspace is actually written as a "Custom Tool".

Let us take a look at how this is written and how it gets loaded by the Lianja App Builder.

If we look in the C:\Lianja\tools folder we will see there is a sub folder called google_charts_wizard. Inside that folder there are two files that make up the tool.


The tool.xml file contains the tool definition.

The command tag specifies what file should be executed that will create and render the tool. This is added into the "Tools" menu with the caption "Google Chart Wizard" and because loadatstartup is set to true it is loaded into a tabpage in the Tools workspace. If you set loadatstartup to false, then a menuitem will be created in the tools menu but the tool will not be created and rendered until the "Google Chart Wizard" menuitem is selected. You can have as many tools open as you want as they are all contained within their own tabpage in the Tools workspace. Clicking the close button on the actual tab exits the tool and removes its tab.

Special note. To add an extension into the PageBuilder Formbar specify an xml "extension" tag as FormBar to the tool.xml file. This will result in the extension being added as a "Builder Extension" rather than a tool in the Tools workspace.

If you did not know, clicking the icon to the left of the page caption e.g. "Tools" in this case will show you the system menu.

The code in main.prg is shown below (this could be, main.php or main.js if you prefer those scripting languages). If using Python, PHP or JavaScript, just specify the filename in your tools subfolder e.g.

Note also that if the command specified in tool.xml is of an unknown extension, it will be run based on its file association on the host operating system. This provides for the ability to run image editors etc from within the Lianja App Builder.

// Sample Lianja tool to load the "Google Chart Wizard"
myobj = createobject("webview")
myobj.url = ""
Lianja.addTool(myobj, "Google Chart Wizard")

So just to summarize.

  • Create a sub-folder under C:\Lianja\tools with the unique name of your tool
  • Inside the sub-folder create an xml file called tool.xml with the format described above
  • Write your custom tool in any of the supported scripting languages
  • Test it :)

So that's it, it is as simple as that.