Move trhough a list forward and backward
Eric at ericwalden.net
Eric at ericwalden.net
Thu Sep 12 09:34:21 UTC 2013
I have an experiment with a list object and I would like to move both
forward and backward through the list depending on the keyboard input. In
other words, a 1 moves backwards and a 2 moves forwards in the list. Below
is the code I have that is not working. This occurs after I display the
list item, so the list index has already advanced from 0 to 1. First, I get
the current index (which works fine) then I check to see if it is greater
than 1 (i.e. 2 or more) because I can't go backwards if I am at the first
item. If the response = 1 then I set a new variable called NewIndex which
is the currentindex -2 (because it has already advanced).
Then I try to set the attribute value back to the new attribute value. But
for some reason, that does not work.
*How can I manually set the index of the current list?*
' My list is called ListOfComputers, and it is a list of computers (the
task is computer shopping and subjects need to be able to move back and
forth
CurrentIndex = c.GetAttrib("ListOfComputers")
'Check to make sure we are far enough along the list to move backwards
if CurrentIndex > 1 then
if ShowMovie.RESP = 1 then
'Use -2 instead of minus one because the in line code occurs after the
presentation slide so the list index has already advanced one space
NewIndex = CurrentIndex - 2
c.SetAttrib "ListOfComputers", NewIndex
end if
end if
' This message box shows all of the variables with the values I want, it
just does not actually change where on the list the next stimuli occurs.
In other words it just keeps running through the list in the predefined
order
msgbox("CurrentIndex = " & CurrentIndex & " NewIndex = " & NewIndex &"
ShowMovie.RESP = " & ShowMovie.RESP)
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/0a5b654c-3415-41b2-88f3-2f8c102f9785%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20130912/a47401c9/attachment.htm>
More information about the Eprime
mailing list