<div dir="ltr">Thank you very much, David! :)<div>It is very nice of you to give such a quick reply!</div><div><br></div><div>I understood what you mentioned, and tried to edit the code as you suggested.</div><div>However, there is still the error :(  and it came from the same line: <span style="font-family:arial,sans-serif;font-size:12.800000190734863px"> </span><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">Set hitObject = theState.Objects("Text1")</span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">the error message is "</span><font face="arial, sans-serif">assignment variables and expression are different types"...</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I then wandered whether it is because I made some mistake in editing my slide.</font></div><div><font face="arial, sans-serif">I had a slide with three slideTexts. I added "keyboard" as the device for response, and the allowance is "2", "3", and "4". </font></div><div><font face="arial, sans-serif">the end action is set as "terminate", but i also tried with "none".</font></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">I have no idea which part can be wrong...</span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">do you have any other suggestion or solution?</span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">thanks a lot again!!!</span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">have a good day!!^______^</span></div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">oli:)</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 5, 2014 at 3:41 AM, David McFarlane <span dir="ltr"><<a href="mailto:mcfarla9@msu.edu" target="_blank">mcfarla9@msu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You did not say what line caused the error message, but I suspect it came up for one of the "hitObject = ..." lines.  That error message, "object does not have an assignable default property", typically comes up when you forget to put "Set" in front of the assignment statement for an object variable (obviously -- NOT!).  In E-Basic/VBA, you must use Set at the start of any assigment statement for an object variable, and you must *not* use Set at the start of any assignment statement for ordinary varibles (you may in this case preface the assigment with the arcane "Let" keyword, otherwise that is implied).  (Yes, this is an absurd rule, peculiar to VBA, and provides many headaches with no compensating advantages.)<br>
<br>
So your hitObject assigment statements should read like<br>
<br>
    Set hitObject = theState.Objects("Text1")<br>
<br>
Also note that for cases "3" & "4" you switch to using ResponseSlide.Name, which I think will not work.<br>
<br>
That said ...  What happens if RESP is not 2, 3, or 4?  Of course, your input mask Allowable may guarantee valid RESP values, but safe programming practice dictates that your code not fail in the event of unexpected inputs.  As it stands, this code would throw a runtime error because hitObject would not be assigned before it reaches the hitObject.BackColor statement.  With that in mind, your code might work out to something like<span class=""><br>
<br>
    Dim theState As SlideState<br>
    Dim hitObject As SlideText<br>
<br>
    Set theState = ResponseSlide.States(<u></u>ResponseSlide.ActiveState)<br></span><span class="">
    Select Case ResponseSlide.RESP<br>
    Case "2"<br></span>
        Set hitObject = theState.Objects("Text1")<br>
    Case "3"<br>
        Set hitObject = theState.Objects("Text2")<br>
    Case "4"<br>
        Set hitObject = theState.Objects("Text3")<br>
    End Select<br>
    If Not(hitObject Is Nothing) Then<span class=""><br>
        hitObject.BackColor = CColor("green")<br>
        hitObject.Draw<br></span>
    Else  ' sanity check<br>
        ' code for invalid response here<br>
    End If<br>
<br>
If you could judiciously rename your objects so that they directly reflected the response value, you could compact this even further, e.g.,<span class=""><br>
<br>
    Dim theState As SlideState<br>
    Dim hitObject As SlideText<br>
<br>
    Set theState = ResponseSlide.States(<u></u>ResponseSlide.ActiveState)<br></span>
    Select Case ResponseSlide.RESP<br>
    Case "2", "3", "4"<br>
        Set hitObject = theState.Objects("Text" & ResponseSlide.RESP)<span class=""><br>
        hitObject.BackColor = CColor("green")<br>
        hitObject.Draw<br></span>
    Case Else  ' sanity check<br>
        ' code for invalid response here<br>
    End Select<br>
<br>
Just some ideas, you can take it from there.<br>
<br>
-----<br>
David McFarlane<br>
E-Prime training online:  <a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank">http://psychology.msu.edu/<u></u>Workshops_Courses/eprime.aspx</a><br>
Twitter:  @EPrimeMaster (<a href="https://twitter.com/EPrimeMaster" target="_blank">https://twitter.com/<u></u>EPrimeMaster</a>)<br>
<br>
/----<br>
Stock reminder:  1) I do not work for PST.  2) You may reach PST's trained staff (and other support facilities) at <a href="https://support.pstnet.com" target="_blank">https://support.pstnet.com</a> .  3) If you do get an answer from PST staff, please extend the courtesy of posting their reply back here for the sake of others.<br>
\----<div><div class="h5"><br>
<br>
<br>
At 9/4/2014 06:43 AM Thursday, Chen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would like to highlight an object based on the subject's response.<br>
<br>
I learned from some codes when an object was selected by the subject with a mouse<br>
<br>
...unfortunately I am not smart enough to apply it in when I ask my subject to give a response by pressing the key "2", "3", or "4".<br>
<br>
 Basically my subject has 3 seconds to make a choice.<br>
<br>
I would like the box surrounding the selected option to change color (to green for example) while the slide is still displayed, or the words (in the text of the slide) change color.<br>
<br>
My code is like this:<br>
<br>
Dim theState As SlideState    '<br>
<br>
Dim hitObject As SlideText<br>
<br>
Set theState = ResponseSlide.States(<u></u>ResponseSlide.ActiveState)    'ResponseSlide is the name of the slide'<br>
<br>
Select Case ResponseSlide.RESP<br>
<br>
Case "2"<br>
<br>
   hitObject = theState.Objects("Text1")<br>
<br>
Case "3"<br>
<br>
   hitObject = ResponseSlide.Name("Text2")<br>
<br>
Case "4"<br>
<br>
   hitObject = ResponseSlide.Name("Text3")<br>
<br>
End Select<br>
<br>
hitObject.BackColor = CColor("green")<br>
<br>
hitObject.Draw<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
the error message is like this:<br>
<br>
The object does not have an assignable default property.<br>
<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Hope someone can help me...I have been stuck for an entire day...;-;<br>
<br>
Thanks a lot in advance!<br>
<br>
OLI:)<br>
</blockquote>
<br>
-- <br>
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:e-prime%2Bunsubscribe@googlegroups.com" target="_blank">e-prime+unsubscribe@<u></u>googlegroups.com</a>.<br>
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com" target="_blank">e-prime@googlegroups.com</a>.<br></div></div>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/5408c098.1243320a.687a.0b18SMTPIN_ADDED_MISSING%40gmr-mx.google.com" target="_blank">https://groups.google.com/d/<u></u>msgid/e-prime/5408c098.<u></u>1243320a.687a.0b18SMTPIN_<u></u>ADDED_MISSING%40gmr-mx.google.<u></u>com</a>.<div class="HOEnZb"><div class="h5"><br>
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/<u></u>optout</a>.<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Yin-Hua, Chen <br><br> Research Center for Mind, Brain and Learning<div><div>National Chengchi University </div><div>No. 64, Sec. 2, Zhi-Nan Rd., Wen-shan District, Taipei City 11605, Taiwan<br><div>Tel: +886 2 2234 4967</div></div></div></div>
</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br />
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/CANgqGTPA%2B0yVTMaDXcepv4%2BtekTHM_4nPeTZFGWdYJUdMctJ3g%40mail.gmail.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/e-prime/CANgqGTPA%2B0yVTMaDXcepv4%2BtekTHM_4nPeTZFGWdYJUdMctJ3g%40mail.gmail.com</a>.<br />
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br />