Thanks for the replies.  I think a lightbulb went on in my head this
afternoon and maybe I'm beginning to understand these widgets.  To get the
form to span tab pages I created a new class over FieldSet called
TabularFieldSet and modified the template so that it displays the
label/field in a table instead of in-line like it does normally.  I still
have some tweaking to do so the names come through correctly, but at least I
think I'm getting a better grasp of things.

        -Jim

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ian Wilson
Sent: Tuesday, January 09, 2007 2:48 PM
To: [email protected]
Subject: [TurboGears] Re: Tabber


The widget browser is decieving.  To get the tabber "magic" to happen
the tabber widget must be returned from the controller.  The class
given in the browser is just an example of the usage.  Ie. TabW is not
a class you would use.

You want to do something like this:

from turbogears.widgets import Tabber

tabberWidget = Tabber()

    @expose(...)
    def tabTest(self, *args, **kw):
        return dict(tabber=tabberWidget)

Then use the tabber by just assigning divs to the tabbertab class
within a tabber div like this:

<div id="tabber" class="tabber">
        <div class="tabbertab"><h2>Tab 1</h2></div>

        <div class="tabbertab"><h2>Tab 2</h2></div>

        <div class="tabbertab"><h2>Tab 3</h2></div>
</div>

You don't actually need to "display" the tabber widget because its
really just a lot of css and javascript that is magically picked up by
turbogears and included in the HEAD section of your html page.

-Ian

On 1/9/07, Jim Steil <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I'm getting a bit frustrated with these widgets now.  I just don't get it.
> I'm trying to get the tabber widget to work and just don't understand what
> I'm doing wrong.  I copied the example from the widget browser as follows:
>
>
>
> In widgets.py I have:
>
>
>
> class TabW(Widget):
>
>     name = 'Tabber'
>
>     for_widget = Tabber()
>
>     template = """<div xmlns:py="http://purl.org/kid/ns#"; id="tabber"
> class="tabber">
>
>         <div class="tabbertab"><h2>Tab 1</h2></div>
>
>         <div class="tabbertab"><h2>Tab 2</h2></div>
>
>         <div class="tabbertab"><h2>Tab 3</h2></div>
>
>         </div>"""
>
>
>
> tabWidget = TabW()
>
>
>
> And then in my controller I have.
>
>
>
>     @tg.expose(template='motion.templates.formula.tabTest')
>
>     def tabTest(self, *args, **kw):
>
>         import time
>
>         return dict(now=time.ctime(), menuLinks=self.menuLinks,
> tabWidget=widgets.tabWidget)
>
>
>
> And then in my kid template I have:
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>
> <html xmlns="http://www.w3.org/1999/xhtml";
> xmlns:py="http://purl.org/kid/ns#";
>
>     py:extends="'../master.kid'">
>
> <head>
>
> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"
> py:replace="''"/>
>
> <title>Formulas</title>
>
> </head>
>
> <body>
>
>   <div id="mainContent">
>
>       <br/>
>
>       ${tabWidget.display()}
>
>   </div>
>
> </body>
>
> </html>
>
>
>
> I'm obviously doing something wrong.  This displays in my browser, but all
I
> get are the three headings, Tab 1, Tab 2 and Tab 3 placed vertically on my
> page just as you'd expect with the HTML in the template.  What do I need
to
> do to get the tab 'magic' to happen?  I tried searching google groups, but
> it seems to be down.  Can anyone offer any help, or a tab example?  I
can't
> find one on the turbogears site either.
>
>
>
>       -Jim
>
>
>  >
>





--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to