The next two afternoon talks (Steve Landers and then Dan Kennedy, both very talented programmers from down under) both deal with the marriage of web browsing and Tcl/Tk. I'll report on both of them together.
Steve Landers: "I was going to write a language called S but that was already taken. Now L is too."
"Tcl meets Ajax. 100% buzzword compliant."
Entice is built on top of [frame -container], and GPS's TkXext (search for X11 window ID by window title, get a handle, re-parent the window by ID).
Firefox talks back to the entice library on a server socket listening from Tcl. Various security features. Tell firefox to connect back to localhost on Entice's port, and get a custom chrome (.xul). Entice substitutes the listening port into the .xul and sends to Firefox.
Controlling Firefox via XMLHttpRequest. Javascript object running in the browser that waits asyncronously for a connection. Basically a GET operation that is asyncronous. It is at the heart of AJAX.
Thanks to GPS for making it possible (TkXext) and Mike Doyle for sponsoring it.
The problem with existing HTML widgets is simple: "Most documents found on the WWW are rendered incorrectly." Lightweight web browsers generally have the same problems (often because CSS is not supported well—if at all).
Although not always possible, Tkhtml3 tries to focus on CSS. Delegates most HTML functionality to the application. More of a CSS renderer than an HTML renderer.
HTML can be specified incrementally. .css (zero to many) must be fully prepared.
The document tree: constructed by parsing step, creates a tree. Not DOM compatible (but provides simillar levels of functionality). For the time being only read access to the tree is provided.
Document tree can be queried: for root node, for all nodes that match a specific selector, for whats under a given mouse coordinate.
Tkhtml does not implement hyperlinks(!). Applications are expected to:
This approach makes for maximum flexibility.
Element handlers: parse handlers, script handlers, and node handlers.
To support images the application implements the -imagecmd callback. The callback is given a URI and is expected to return a Tk image.
Tkhtml3 uses images as backgrounds, list markers, and as replaced content.
Replacement objects. Any node in the tree can be mapped to display in another widget in place of a node's content.
Applications can specify regions of text to be tagged.
Leverages existing Tcl/Tk extensions. [img] allows it to support more image types than any other web browser(!). The tls package for SSL, etc.
Available at tkhtml.tcl.tk. The shared library on Linux is ~220kb.
—Michael A. Cleverly
Wednesday, October 11, 2006 at 16:29
Being able to embed something like XUL into Tcl/Tk would be great! It's hard to tell from this web page whether this is possible. (If it is, please provide some details.)
Thanks!!