Previous | ||
HTML interfaces
|
||
Home ▸ Documentation ▸ Smile ▸ Custom GUI ▸ HTML interfaces | ||
You can make HTML interfaces to Smile as an alternative to GUI aqua dialogs. Such interfaces are regular HTML files eventually including or importing images, javascript, css, etc. Some examples are provided in the /Applications/Smile/Script examples/Smile examples/User Interface examples folder. With the Smile Server license, you make such a HTML interface into a web application that all users in the Internet can run in their browser. Editing HTML in SmileIn Smile, HTML files open in Unicode windows where you can edit the HTML source. Pressing ⌘R renders the HTML in a new window. Moreover, pressing ^⌘R checks the XML syntax and pressing ⌥⌘R checks the validity of the XML with respect to its DTD. Please read the documentation about Unicode window.How to display HTML in Smile by script The class of windows to display HTML in Smile is the web window. To load a HTML page (or a JPEG image, etc) set the web window's path name property to an alias or a string which makes a valid URL.Calling Smile from JavaScript: the AS JavaScript objectset w to make new web window with properties {path name:alias "...:index.html", script: alias "...:myScript.scpt"}Alternately you can directly provide HTML source into the contained data property. This can be useful if you generate the HTML contents dynamically.set w to make new web window The web window contains a special AS JavaScript object in order to communicate with Smile. This object has no property, but all its functions are interpeted as calls to some AppleScript handler. Example: suppose that you have defined an Applescript handler as:Calling JavaScript from Smileon foo(s)This handler may be in the context of Smile or in the script of the web window.
For debugging purpose, you can also open a JavaScript console with the contextual menu.Comparison between HTML and Aqua dialogs
Such interfaces are recommended to people familiar with HTML/javascript development. They benefit from the dynamic layout of HTML rendering, the use of css, the powerfulness of javascript, etc. HTML browsing is often more suitable to multiple pages contents. HTML can be more easily generated, for example using XSLT. Such HTML interfaces can be ported to the web using Smile Server features. For simple cases, Aqua dialogs can be developed more quickly in Smile. Smile claims to handle the URL scheme "smile". |
Version française | ||
Copyright ©2010 Paris, Satimage |