[Openmcl-devel] Lisp User Interface LUI

Terje Norderhaug terje at in-progress.com
Fri Jan 9 07:58:42 UTC 2009


On Jan 8, 2009, at 9:41 PM, Terje Norderhaug wrote:
> On Jan 2, 2009, at 11:30 AM, Alexander Repenning wrote:
>> This may be a good moment to discuss some of the ideas regarding
>> the creation of LUI, the "Lisp User Interface as a cross platform,
>> but Mac first" open source GUI tool.
>
> One technique that I have found very useful through the years is to
> automatically generate the user interface from extended/amended type
> declarations of the information to be presented and/or modified.  I
> know other LISP developers are using similar strategies.

Applying this to the previous examples, consider the "OpenGL 3D"  
window in the earliers posting.  It contains sliders that (with style  
information separated out) are represented by elements like this in  
an XML based layout template:

      <slider name="red" action="adjust-vertex-color-action" max- 
value="1.0"/>

Say the LISP application declares the red, green and blue editable  
variable values to be real numbers between 0.0 and 1.0, using  
constructs like:

     (defvalue red-vertex 0.0
	(:documentation "the amount of red color")
	(:name "red")
         (:type (real 0.0 1.0))
         (:action adjust-vertex-color-action)
         (:group color))

This declaration provides sufficient information to infer that the  
red-quantity can be presented and modified using a slider on a Mac,  
and that the value is between 0 and 1. Thus an external layout for  
the window would no longer have to specify the use of sliders nor the  
max value, but may use a more general value placeholder. This leaves  
more to the user interface engine, opening for automatically adapting  
the presentation to the platform and/or context.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unknown.tiff
Type: image/tiff
Size: 32326 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20090108/0083b1c3/attachment.tiff>
-------------- next part --------------

Using that the application has more information about the editable  
and presentable information, the layout might be simplified and more  
of the presentation can be defined in the stylesheet (or  
alternatively inferred by the interface engine), perhaps leading to a  
layout like e.g. this:

<application-window>
    <value name="red"/>
    <value name="green"/>
    <value name="blue"/>
   <visual name="opengl"/>
   <group>
     <visual name="opengl2"/>
     <visual name="opengl3"/>
   </group>
</application-window>

Here is a possible corresponding stylesheet:

<style select="application-window" title="OpenGL 3D" margin="12"  
width="300" height="300" display="column" align="stretch"  
valign="stretch" />
<style select="value" flex="1" display="row" minimize="vertical"  
align="stretch" valign="middle"/>
<style select="value#red" label="Red">
<style select="value#green" label="Green">
<style select="value#blue" label="Blue">
<style select="value:label" align="right" width="50"/>
<style select="visual" vflex="1"/>
<style select="visual#opengl" display="row" margin-top="12/>
<style select="group" display="row" align="stretch" valign="stretch"  
vflex="2" margin-top="12"/>
<style select="visual#opengl2" margin-right="6"/>
<style select="visual#opengl3" margin-left="6"/>

Processing this information, the user interface engine can build the  
same window as the original "OpenGL 3D" application-window XMLisp  
template.

-- Terje Norderhaug



More information about the Openmcl-devel mailing list