I am doing it without nav or selector, by delegating the creation of pane 
titles and the active pane content to external code. In pseudo code:

(defwidget dynamic-tabs()
   (pane-titles-fn)   ;; e.g '((1 . "employees") (2 . some-widget))
   (active-pane-id)
   (active-pane-content-fn)

(defmethod render-widget-body  ((self dynamic-tab))
   
   (with-html
       (dolist (title (funcall (pane-titles self)))
           (if (equal (active-pane-id self) (car title))               
              (:span (cdr title))                                   
              (render-link (lambda (title) (setf (active-pane-id self) (car 
title)) (cdr title)))    
      (setf (widget-children self) (funcall (active-pane-content-fn self) 
(car title)))


I know there is a lot of indirection but it suit my specific needs. PRoblem 
is that the url reflects nothing of this, which I dont need, so I dont 
consider it a generic solution.
Also instead of 
      
(if (equal active-pane-id (car title))               
              (:span (cdr title))                                   
              (render-link (lambda (title) (setf (active-pane-id self) (car 
title)) (cdr title)))    

you could have 
  (if (equal active-pane-id (car title))               
       (render-active title)                                   
       (render-other title self)
so that you can have whole widgets as titles,
taking care to render a link that will setf the active pane of the parent 
somewhere in render-other in order to be able to switch panes. (thats why I 
pass self as an argument). 


   


-- 
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/weblocks/-/TgUU42xryHMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en.

Reply via email to