herth / ltk

42 stars 13 forks source link

How to create a treeview with columns ? No documentation of treeview ? #5

Open vindarel opened 5 years ago

vindarel commented 5 years ago

Hi,

If I'm not mistaken, there is no documentation of treeview on the website: http://www.peter-herth.de/ltk/ nor in the pdf.

I was able to create a simple treeview with text, with make-instance 'treeview and treeview-insert:

      ...
        (let* ((c.searchbox (grid (make-instance 'entry :width 7)
                                  0 0 :sticky "we" :padx 5 :pady 5))
               (c.tree (grid (make-instance 'treeview)
                             1 0 :sticky "we" :padx 5 :pady 5)))
          (loop for row in *dummy*
               do (treeview-insert c.tree :text row))
       ...

now I am interested in creating a treeview with columns. How do we do it ? There is column-configure, treeview-column. I am also looking at this doc: https://tkdocs.com/tutorial/tree.html

Thanks

ps: otherwise the doc is very good, thanks :)

vindarel commented 5 years ago

I got my simple example, but my question about the official doc still holds.

(with-nodgui ()
    (let ((tree  (make-instance 'scrolled-treeview
                                ;; a treeview always has a first column.
                                :columns (list "col2"))))
      ;; We place our widget on the grid to see it.
      (grid tree 1 0)
      (loop for data in '("aaa" "bbb" "ccc")
         do (treeview-insert-item tree
                                  ;; text of the first column.
                                  :text data
                                  ;; text of the other columns.
                                  :column-values (list "val2")))))