OK. You should try the following: var accordion = button.getAncestor(org.apache.pivot.wtk.Accordion.class);
If that doesn't work you may need to write a helper function or method to convert a String to a Class. See getAncestor(String) in the 2.0 source for Component: http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java On Dec 3, 2010, at 8:27 AM, MSafiri wrote: > > Dear Greg, > > Yes, I did what you proposed. The set-up is the following: I have a wtkx > file which is the main file for the accordion, its code is below: > > <Window title="Accordions" maximized="true" > xmlns:wtkx="http://pivot.apache.org/wtkx" > xmlns="org.apache.pivot.wtk" > preferredWidth="500" preferredHeight="300"> > <content> > <Accordion wtkx:id="accordion" styles="{padding:0}"> > <panels> > <wtkx:include wtkx:id="destinationPanel" > src="cstDelegatorDialogDestination.wtkx" Accordion.label="Destination"/> > <wtkx:include wtkx:id="descriptionPanel" > src="cstDelegatorDialogDescription.wtkx" Accordion.label="Description"/> > <wtkx:include wtkx:id="budgetPanel" > src="cstDelegatorDialogBudget.wtkx" > Accordion.label="Budget"/> > <wtkx:include wtkx:id="progressUpdatePanel" > src="cstDelegatorDialogProgressUpdate.wtkx" Accordion.label="Progress > Calculation"/> > <wtkx:include wtkx:id="summaryPanel" > src="cstDelegatorDialogSummary.wtkx" Accordion.label="Summary"/> > </panels> > </Accordion> > </content> > </Window> > > Then I have 6 panels, which are the elements of the accordion. Each of them > has a wtkx:id defined, and each wtkx:id is different, depending on the > purpose of the panel. > > The code used on each panel to advance to the next one is this: > > <PushButton wtkx:id="nextButton" buttonData="Next" > styles="{minimumAspectRatio:3}"> > <buttonPressListeners> > <wtkx:script> > importPackage(org.apache.pivot.wtk); > function buttonPressed(button) { > <!--- var accordion = > button.getAncestor("org.apache.pivot.wtk.Accordion"); --> > accordion.selectedIndex += 1; > } > </wtkx:script> > </buttonPressListeners> > </PushButton> > > I hope I was able to give more information. > > Regards, > > MSafiri > -- > View this message in context: > http://apache-pivot-users.399431.n3.nabble.com/Script-Problem-Accordion-tp1966316p2011534.html > Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
