Move trhough a list forward and backward

David McFarlane mcfarla9 at msu.edu
Thu Sep 12 21:05:47 UTC 2013


I think you will just have to pull your attributes from the List as 
needed manually in code using List.GetAttrib, see that topic in the 
E-Basic Help facility.  E.g., suppose you have a List named MyList, 
with attributes MyAttrib1 and MyAttrib2, you use the variable iList 
(possibly global) for your List index, and you already have code to 
change iList as needed.  Then you would load your attributes with

     c.SetAttrib "MyAttrib1", MyList.GetAttrib(iList, "MyAttrib1")
     c.SetAttrib "MyAttrib2", MyList.GetAttrib(iList, "MyAttrib2")

-----
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (https://twitter.com/EPrimeMaster)

/----
Stock reminder:  1) I do not work for PST.  2) PST's trained staff 
take any and all questions at 
http://support.pstnet.com/e%2Dprime/support/login.asp , and they 
strive to respond to all requests in 24-48 hours, so make full use of 
it.  3) In addition, PST offers several instructional videos on their 
YouTube channel (http://www.youtube.com/user/PSTNET ).  4) If you do 
get an answer from PST staff, please extend the courtesy of posting 
their reply back here for the sake of others.
\----


At 9/12/2013 05:34 AM Thursday, Eric at ericwalden.net wrote:
>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/52322cbd.2e43320a.6d17.1327SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.



More information about the Eprime mailing list