X Tags - gd-99/symbiogd GitHub Wiki

X-Tags enables the developer to separate the interface and the application logic.

Create a user interface

To create a new interface, just create a file named /usr/share/templates/yourApp/main.html.

You can use all HTML elements, but also Symbiose's widgets.

<x-window width="300"> <!-- A Window -->
   <h1>My super window!</h1> <!-- Window's title -->
   <p>Hello World!</p>
</x-window>

How to use widgets

To insert a widget, you'll have to create a tag which has the name: x- plus the widget's name. For example, to insert the widget switchButton, you will put the tag <x-switchButton></x-switchButton>.

You can specify the widget's options as attributes:

<x-window width="300" title="My super window!" resizable maximizable="0"></x-window>

This will create a new window with a width of 300px and the title My super window!, resizable but not maximizable.

Full example

A good example of X-Tags use in the webos is the app The Widget Factory. Have a look on the file /usr/share/templates/twf/main.html!

Displaying the interface

To show the interface, a javascript file must be created in order to:

  • load the interface file (the HTML file created previously),
  • open your app's window.
W.xtag.loadUI('/path/to/the/html/file', function(myWindow) { //Load the HTML file
	$(myWindow).window('open'); //Open the window
});
⚠️ **GitHub.com Fallback** ⚠️