<a href="http://upload.wikimedia.org/wikipedia/commons/a/a6/Gnucash_2_screenshot.png">http://upload.wikimedia.org/wikipedia/commons/a/a6/Gnucash_2_screenshot.png</a><br>the gnucash screenshot shows a pretty full featured &#39;widget&#39; including;<br>
- resizable columns<br>- twisties<br>- images<br><br>s.<br><br><br><div class="gmail_quote">On Tue, Sep 8, 2009 at 6:09 PM, Stephen De Gabrielle <span dir="ltr">&lt;<a href="mailto:spdegabrielle@gmail.com">spdegabrielle@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">How would you implement that?<br><br><br><br>Another  iteration<br><br><br>#lang scheme/gui<div class="im">
<br><br>(define grid-pasteboard%<br>  (class pasteboard%<br>    (init-field w h)<br></div><div class="im">    (define/override (insert snip r c) (super insert snip (* c w) (* r h)))<br>
    (super-new)))<br><br><br></div>;; accepts data-grid (list of columns)<br>(define data-grid-pasteboard%<br>  (class pasteboard%<br>    (init-field data-grid<br>                (col-widths &#39;(75 55 65))<br>                (row-height 16)<br>

                )<br>    <br>    ;; create new list that is the cumulative sum of the source list<br>    (define (cumulative-sums offsets)<br>      (foldl (lambda (offset cum-list) <br>               (append cum-list (list (+ offset (last cum-list)))))<br>

             (list 0) ; start from 0<br>             offsets))<br>    ;; column widths -&gt; col offsets <br>    (define (column-offsets col-widths)<br>      (cumulative-sums (drop-right col-widths 1)))<br>    ;; <br>    <br>

    (define col-offset<br>      (let ((offsets (column-offsets col-widths)))<br>        (lambda (col) (list-ref offsets col))))<br>    ;; rows are all the same height<br>    (define (row-offset row)<br>      (* row row-height))<br>

    ;; initialise pasteboard<br>    <br>    (define/override (insert snip row col) <br>      (super insert snip (col-offset col) (row-offset row)))<br>    (define (grid-ref datagrid row col)<br>      (list-ref (list-ref datagrid col) row)<br>

      )<br>    (super-new)<br>    (for ([col (in-range (length data-grid))])<br>      (for ([row (in-range (length (car data-grid)))])<br>        (insert (make-object string-snip% (grid-ref data-grid row col))<br>                row col)<br>

        ))<br>    <br>    ))<div class="im"><br>(define f (new frame% [label &quot;Simple Edit&quot;]<br>               [width 200]<br>               [height 200]))<br>(define c (new editor-canvas% [parent f]))<br>(define t (new  grid-pasteboard% (w 66) (h 16)))<br>

(send t insert (make-object string-snip% &quot;at23&quot;) 2 3)<br>(send t insert (make-object string-snip% &quot;at23&quot;) 2 2)<br>(send t insert (make-object string-snip% &quot;at23&quot;) 3 2)<br>(send t insert (make-object string-snip% &quot;at23&quot;) 1 1)<br>

(send t insert (make-object string-snip% &quot;at23&quot;) 0 0)<br>(send c set-editor t)<br>(send f show #t)<br><br></div>;; <br><br>(define f2 (new frame% [label &quot;Simple Edit&quot;]<br>                [width 200]<br>
                [height 200]))<br>
(define c2 (new editor-canvas% [parent f2]))<br>(define t2 (new data-grid-pasteboard% <br>                (data-grid <br>                 &#39;((&quot;name&quot; &quot;Stephen&quot; &quot;Patrick&quot;)<br>                   (&quot;age&quot; &quot;39&quot; &quot;38&quot;)<br>

                   (&quot;eye-colour&quot; &quot;green&quot; &quot;blue&quot;)<br>                   ))))<br>(send c2 set-editor t2)<br>(send f2 show #t)<div><div></div><div class="h5"><br><br><br><div class="gmail_quote">
On Tue, Sep 8, 2009 at 2:01 PM, praimon <span dir="ltr">&lt;<a href="mailto:praimon@gmail.com" target="_blank">praimon@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
Thanks for your work. It seems we have this conversation every year or two.<br>
One of the most important features of the directory-table widget is the ability<br>
to manually resize the columns. Otherwise, either some of the data will be<br>
hidden/lost or the table needs to be too large (so as to accomodate<br>
any conceivable<br>
data entry).<br>
regards,<br>
<font color="#888888">praimon<br>
</font><div><div></div><div><br>
On Tue, Sep 8, 2009 at 2:15 AM, Stephen De<br>
Gabrielle&lt;<a href="mailto:spdegabrielle@gmail.com" target="_blank">spdegabrielle@gmail.com</a>&gt; wrote:<br>
&gt; Hi, people have asked about a data grid on this list a few times.<br>
&gt;<br>
&gt; This is the simplest possible approach. I&#39;ve tried and abandoned other<br>
&gt; approaches when I realised they were too much work for my available free<br>
&gt; time.<br>
&gt;<br>
&gt; Comments appreciated.<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><div><div></div><div class="h5">-- <br><br>--<br>Stephen De Gabrielle<br><a href="mailto:stephen.degabrielle@acm.org" target="_blank">stephen.degabrielle@acm.org</a><br>
Telephone +44 (0)20 85670911<br>Mobile        +44 (0)79 85189045<br>
<a href="http://www.degabrielle.name/stephen" target="_blank">http://www.degabrielle.name/stephen</a><br><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><br>--<br>Stephen De Gabrielle<br><a href="mailto:stephen.degabrielle@acm.org">stephen.degabrielle@acm.org</a><br>Telephone +44 (0)20 85670911<br>Mobile        +44 (0)79 85189045<br>
<a href="http://www.degabrielle.name/stephen">http://www.degabrielle.name/stephen</a><br><br>