« Return to Thread: ViewTabs

Re: ViewTabs

by Nicholas Moore :: Rate this Message:

Reply to Author | View in Thread

Rob

Each of my WebApp pages (viewMain) does:

viewMain
    | e |
    e := WebElement new.
    self session parent site style
        headerAddTabs: e
        selected: 1
        label: 'Home'.
etc ...


which is implemented in my subclass of WebStyle:

headerAddTabs: anElement selected: aNumber label: aLabel
    | anE newOC |
    newOC := OrderedCollection new.
    anE := WebElement new addText: aLabel attributes: #bold.
    newOC add: anE.
    anElement add: ((WebTabs new)
                addLinkTo: './centre.html' text: 'Home';
                addLinkTo: './forum.html' text: 'Forum';
                addLinkTo: './news.html' text: 'News';
                addLinkTo: './history.html' text: 'History';
                addLinkTo: './search.html' text: 'Search';
                selected: aNumber).
    (anElement elements first elements at: aNumber) initElements elements
        add: anE.
    anElement addNbSp.
    ^anElement

check out:
http://www.c4cnc.org for an example.


Nicholas


Rob Rothwell wrote:
Are ViewTabs meant to be used when you have several views you want to display within a single WebApplication?  Does anyone have an example?  When I create the following, clicking on ANY of the tabs simply takes me to #viewMain:

MyApp>>tabComponent
    | e |
    e := ViewTabs new.
    e addView: #viewMain description: 'Tab1'.
    e addView: #viewDiagnosis description: 'Tab2'.
    e addView: #viewProcedures description: 'Tab3'.
    ^ e

and

MyApp>>viewMain
    |e|
    e := WebElement newId: #content.
    e addTextH1: 'My Application'.
    e addBreak.
    e add: self tabComponent.
    e addText: 'Main View'.
    self pageFrameWith: e title: 'My Application'

MyApp>>viewDiagnosis
    |e|
    e := WebElement newId: #content.
    e addTextH1: 'My Application'.
    e addBreak.
    e add: self tabComponent.
    e addText: 'Diagnosis View'.
    self pageFrameWith: e title: 'My Application'


MyApp>>viewProcedures
    |e|
    e := WebElement newId: #content.
    e addTextH1: 'My Application'.
    e addBreak.
    e add: self tabComponent.
    e addText: 'Procedure View'.
    self pageFrameWith: e title: 'My Application'

Rob

_______________________________________________ Aida mailing list Aida@... http://lists.aidaweb.si/mailman/listinfo/aida

--
NJM TSR-i

Nicholas J Moore



_______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida

 « Return to Thread: ViewTabs

LightInTheBox - Buy quality products at wholesale price