[Xerte] Using getPageIndex() to fill an array

Paul Swanson Paul.Swanson at harlandfs.com
Wed Jun 24 21:26:17 BST 2009


"I seek the Holy Grail."  ;o)
 
See Julian's reply for your answer.
 
______________________________

 Paul Swanson
 Instructional Designer
 Harland Financial Solutions
 Paul.Swanson at harlandfs.com
______________________________

________________________________

From: xerte-bounces at lists.nottingham.ac.uk on behalf of Fred Riley
Sent: Wed 6/24/2009 10:16 AM
To: Xerte discussion list
Subject: [Xerte] Using getPageIndex() to fill an array



Ok, this might take some explaining, so apologies in advance for the
length and abstruseness of the message. I'm trying to complete a Xerte
application which was partly finished over a year back by a colleague
who then had a bad car accident then recovered and moved on to better
things. The application looks pretty well put together, as the colleague
did it in consultation with Julian, so I'm not being critical at all,
but as any coder will know it's always hard to dissect someone else's
work particularly when there are no application notes to consult.

The current version of the application is online at
http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/ruefulrabbit.htm
(Xerte XML file at
http://www.nottingham.ac.uk/~ntzfr/rlos/mentoring/test/mentoring_ruefulr
abbit.rlo). As the user goes through each section, s/he is invited to
type reflective text into fields on some pages, then that text should
get presented to the user for further reflection and printing in a
summary page at the end. The user text is held in an array 'texts'
initialised in an opening framework by:

texts = new Array();

On each page where there's a text field, new elements are added to the
array containing the user input:

texts[rootIcon.getPageIndex() - 2] = icon.parentNode.clip().text;

The minus figure varies from page to page in a not clear, to me, way.
Julian writes that getPageIndex() "tells you the current page number on
rootIcon" and then goes on to qualify this with "getPageIndex() - 1 is
required if the first child of the interface is an entry frame". I think
I understand this, but when I try some traces to find out what
getPageIndex() is returning, such as below:

pagenum = rootIcon.getPageIndex();
debug("page index: " + pagenum);

the same value (in this case 2) is returned. That's probably all as
clear as mud, but this is complex to explain in text without the
application on screen. My questions are:

1. What is it that getPageIndex() is returning, and why is it always the
same value regardless of which page it's on?
2. Is there a better way of adding array elements page by page?

I could really kludge it and manually set the texts array element
number, eg:

i = 10; // or whatever
texts[i] = icon.parentNode.clip().text;

but that would fail if I then added or removed pages. Any suggestions?

Thank you for your time. I'm now off for a little rest after all that
typing :o)

To use a Pat method to see if you've read this far: What is your quest?

Cheers

Fred

Fred Riley
Learning Technologist
School of Nursing, Midwifery and Physiotherapy, University of Nottingham
Vcard: http://www.nottingham.ac.uk/nursing/sonet/about/fr_uon.vcf
_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte





More information about the Xerte mailing list