<HTML dir=ltr><HEAD><TITLE>[Xerte] Using getPageIndex() to fill an array</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.6000.16850" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText74131 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Instead of using rootIcon.getPageIndex(), you need to use iconID.getPageIndex(), where iconID is the id of the framework you are interested in. If you are in the top level page, but then drop into a nested framework, then rootIcon.getPageIndex() will always return the same number ( as you haven't changed page on the interface icon, i.e. rootIcon ) as you navigate through the nested framework.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Does that help?</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk on behalf of Fred Riley<BR><B>Sent:</B> Wed 24/06/2009 18:16<BR><B>To:</B> Xerte discussion list<BR><B>Subject:</B> [Xerte] Using getPageIndex() to fill an array<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Ok, this might take some explaining, so apologies in advance for the<BR>length and abstruseness of the message. I'm trying to complete a Xerte<BR>application which was partly finished over a year back by a colleague<BR>who then had a bad car accident then recovered and moved on to better<BR>things. The application looks pretty well put together, as the colleague<BR>did it in consultation with Julian, so I'm not being critical at all,<BR>but as any coder will know it's always hard to dissect someone else's<BR>work particularly when there are no application notes to consult.<BR><BR>The current version of the application is online at<BR><A href="http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/ruefulrabbit.htm">http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/ruefulrabbit.htm</A><BR>(Xerte XML file at<BR><A href="http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/mentoring_ruefulr">http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/mentoring_ruefulr</A><BR>abbit.rlo). As the user goes through each section, s/he is invited to<BR>type reflective text into fields on some pages, then that text should<BR>get presented to the user for further reflection and printing in a<BR>summary page at the end. The user text is held in an array 'texts'<BR>initialised in an opening framework by:<BR><BR>texts = new Array();<BR><BR>On each page where there's a text field, new elements are added to the<BR>array containing the user input:<BR><BR>texts[rootIcon.getPageIndex() - 2] = icon.parentNode.clip().text;<BR><BR>The minus figure varies from page to page in a not clear, to me, way.<BR>Julian writes that getPageIndex() "tells you the current page number on<BR>rootIcon" and then goes on to qualify this with "getPageIndex() - 1 is<BR>required if the first child of the interface is an entry frame". I think<BR>I understand this, but when I try some traces to find out what<BR>getPageIndex() is returning, such as below:<BR><BR>pagenum = rootIcon.getPageIndex();<BR>debug("page index: " + pagenum);<BR><BR>the same value (in this case 2) is returned. That's probably all as<BR>clear as mud, but this is complex to explain in text without the<BR>application on screen. My questions are:<BR><BR>1. What is it that getPageIndex() is returning, and why is it always the<BR>same value regardless of which page it's on?<BR>2. Is there a better way of adding array elements page by page?<BR><BR>I could really kludge it and manually set the texts array element<BR>number, eg:<BR><BR>i = 10; // or whatever<BR>texts[i] = icon.parentNode.clip().text;<BR><BR>but that would fail if I then added or removed pages. Any suggestions?<BR><BR>Thank you for your time. I'm now off for a little rest after all that<BR>typing :o)<BR><BR>To use a Pat method to see if you've read this far: What is your quest?<BR><BR>Cheers<BR><BR>Fred<BR><BR>Fred Riley<BR>Learning Technologist<BR>School of Nursing, Midwifery and Physiotherapy, University of Nottingham<BR>Vcard: <A href="http://www.nottingham.ac.uk/nursing/sonet/about/fr_uon.vcf">http://www.nottingham.ac.uk/nursing/sonet/about/fr_uon.vcf</A><BR>_______________________________________________<BR>Xerte mailing list<BR>Xerte@lists.nottingham.ac.uk<BR><A href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</A><BR></FONT></P></DIV></BODY></HTML>