BrowseX
SourceForge Logo
BrowseX
 Home
 News
 Download
 Features
 Demos
 
 API
 SQLite
 TML
 Dballoc
 Javascript
 Mailer
 Address
 Mimetypes
 Portal
 DynDNS
 Talk
 ZipView
 TDB
 Packaging
 Passman
 Thin
 
 Press
 Docs
 Bugs
 FAQ
 Pros
 Why
 License
 Contacts

Search
Links
 Scriptics
 Tkhtml
 Postgres
 OpenSSL
 Img
 Baremetal

Contact
peter@browsex.com

TML Applications

copyright © 2000-2001 - Peter MacDonald http://www.browsex.com

Table Of Contents

Introduction To TML Applications

Imagine you could write GUI applications that run on your desktop like normal desktop programs, and then even work the same way over the Internet. Further, the application could even function as a web app via any standard Web Browser without messy plugins or JS. Moreover, say that on the desktop, the applications are small, fast and stable (ie. we're not talking about Java or Javascript).

The above is a description of TML Applications. TML is a script-like language that imbeds Tcl and is used to generate HTML output. But not just normal HTML, Tk attributed HTML. Since, BrowseX  renders HTML by using Tk widgets for form elements, it can overload attributes to access the Tcl options of these widgets. Moreover, TABLEs can be overloaded to put table data into a Tktable widget. using TML as a cgi, allows normal browsers to work as well. In this way, hybrid applications can be written which work both on the Desktop and the World Wide Web.

Although you could use Javascript to develop apps, Tcl provides more flexability. The difference between TML and Javascript can be summerised as follows:

  • TML allows simple communication between windows
  • TML does not suffer from stability/scalability problems
  • TML is both client side and/or server side (CGI)
  • TML allows easy data accessed over the web
  • Native Tk widgets are used in Browsex for form elements, and TML lets you directly access these attributes.
  • TML reduces the amount of markup in a document
  • Tcl is widely used, because people like it.

Running a TML application under BrowseX provides for complex user interaction not practical in normal browsers. Other Tcl advantages such as multi-language support come for free. Used with a regular browser (via the BrowseX Web Portal or the TML CGI) and it acts like an HTML/Web CGI based application. HTML access does give fewer features (ie. a 2 dimensional woodeness) when compared to Tk/Browsex, however it is functional and does give remote access to the application.

The major difference in operation between the two models is that data is manipulated directly under Tcl, whereas under the Web a form submit is required to effect data updates. In other words, Tcl can handle local manipulation of data; other web browsers cannot.

Rolodex is an Address Book written in about 250 lines of TML. Click here to view the source. The purpose of Rolodex is to show that it is possible to write an application that combines the accessabilty of the Web with the usability and power of standalone programs.

TML Applications are possible because of the way Browsex implements web page FORMs using ordinary Tk widgets such as buttons and entries (via Tkhtml). BrowseX  takes advantage of this mapping and provides direct access to widgets permitting complex application interaction that is just not practical with regular web programming. Moreover, developers can save time by using HTML for the Tcl layout. Conversely, when used via the Web, all of the basic functionality is still available, but the feel-good, nice-to-have things like instant-feedback are missing.

Note that in both cases, a TML application normally runs inside a SafeTcl interpreter. Special access functions have been provided to allow reading and writing data to/from disk, a database, or the network. In fact, there are actually three different ways of running a TML application.

  • Any browser, using remote TML server side CGI (or brx portal)
  • Native BrowseX locally
  • Native BrowseX, remotely

In the last two modes, the application looks and acts virtually the same. However, in the last case the data is actually stored on a remote server which is accessed vi the web. There are several _tml variables to define which of the various modes we are running in.

islocal executing as a local file:/ tml file in BrowseX .
isremote executing as a remote http:/ tml file in BrowseX .
iscgi executing as a cgi producing HTML for a normal browser.


Table of Contents

Copyright © 1999-2001   Browsex Systems Inc   http://BrowseX.com

 


TML Source Code For This Page