changing border color of a slide image after clicking on it

haslinger.hans11 at gmail.com haslinger.hans11 at gmail.com
Wed Oct 16 09:20:31 UTC 2013


Hallo David
 
Thank you for your help.
 

> At this point I would need you to draw 

out a very clear diagram of your Procedure structure, along with clear 
> specifications of what you want it to do

 
The Procedure looks  like this:
 
 
...
...
 
ExternalCausesProc
      ExternalCausesList
           ExternalCausesTrialProc
               Instruction (TextBox)
               restart2 (Label)
               ExternalCausesSlide (Slide)
               InLine2 (InLineCode)
...
...
 
 
After a short Instruction, there is an Image presented on the 
ExternalCausesSlide as a Stimulus (e.g. child is getting a birthday 
present). 
There is also a SoundOut on the ExternalCausesSlide which describes the 
scene in the Image.
Additionaly there are 4 smaller Images as possible answers for the Stimulus 
Image.
I've made an attribute for every Image and the SoundOut in my 
ExternalCausesList.
 
Subjects should have time to click on one of the 4 target Images until the 
SoundOut was played completely.
I want to highlight the Image a subject chooses by changing the border 
color of that Image to "cyan" (black is my default border color) so the 
subject knows that its answer was registered and it can change the current 
answer (this is another thing i could need some help with).
 
I tried to implement the following code (which i've found somewhere in this 
google group) for changing the border color to "cyan" and back to "black" 
(default setting) before a new Stimulus is presented:
 
Dim hitObject As SlideImage
   Set hitObject = 
CSlideImage(ExternalCausesSlide.States("Default").Objects(strHit))       
  
            hitObject.BorderColor = CColor("cyan")
            hitObject.Draw 
            Sleep 5000
  
      hitObject.BorderColor = CColor("black")
 
 
 
The current slide should be terminated after the Sound is played so I've 
set  "End Sound Action" to "Terminate"    and "End Action" (in the 
ExternalCausesSlide Properties) to "none".
Now the color changed to "cyan" after the Sound was played  and not 
immediately after the click.
 
So i've changed the Settings to "End Action" -> "Terminate" and 
"EndSoundAction" -> "Terminate".
Now the color changed immediately after the click occured and remained 
"Cyan" for 5sec before changing back to "black".  
But if the click occured at the end of the SoundOut with less than 5sec 
remaining, there was an interference with the Sound of the following 
Stimulus. 
 
Then I've tried "End Action" -> "Terminate" and "End Sound Action" -> 
"none".
Now the Color changes immediately after the click and remains for the 5 sec 
no matter if the Sound is completely played or not.
But if no click occurs, there is no termination. 
 
 
Now I thought I could use the "Terminate/Terminate"-setting  and a Sleep 
time which is equal to the remaining duration of the sound file after the 
click occured, (something like  Sleep "Duration Sound - RT (Time until 
click?)).
This way, the slide would terminate after the click + Sleep time or if the 
sound file was played completely (if there was no click). 
There would also not be any interference with the following Sound file, 
because the Sleep time is never longer than the Sound file itself.
 
 
 

> That said, first, you do not understand your code correctly.  As 
> written, it means the color of the image, which was clicked, changes 
> to "cyan" and would later change to "black" at whatever time your 
> hitObject gets redrawn, and goodness knows when that will happen.

 
 
Actually, it changes back to "black". 
But maybe that is just because "black" ist my default border color and the 
settings are just reset to the default settings after Sleep.
 
 

> As a general strategy, I prefer to do as much as possible through the 
> program structure & object properties, and to leave less to inline code.

 
 
Actually this was the prefered strategy for my project and it worked fine 
except for strHitTest for collecting Mouse Responses and logging the 
correct answer.
Basically my program is completed, but i would like to add some little 
improvements, like this highlighting thing, to make it look better  
 
I hope my remarks are not too confusing.
 
 
Best regards 
Hans
 
 

Am Dienstag, 15. Oktober 2013 16:37:46 UTC+2 schrieb McFarlane, David:

> Hans, 
>
> I am afraid that I do not quite follow all of this.  You refer to a 
> Slide, a SoundOut, and an Inline, and I do not know how they all 
> interrelate (in particular, I do not recall the complication of a 
> SoundOut in your first post).  At this point I would need you to draw 
> out a very clear diagram of your Procedure structure, along with 
> clear specifications of what you want it to do. 
>
> That said, first, you do not understand your code correctly.  As 
> written, it means the color of the image, which was clicked, changes 
> to "cyan" and would later change to "black" at whatever time your 
> hitObject gets redrawn, and goodness knows when that will happen.  If 
> you want your inline code to make the BorderColor black, then you 
> must also follow that line with another hitObject.Draw command, which 
> is missing from your code without comment.  If you left that out on 
> purpose (e.g., because the redraw will be taken care of by a later 
> object), then you must add a comment to your code to explain that. 
>
> As far as settting the Sleep time to something like "remaining time 
> of SoundOut", I suppose you might use some combination of Clock.Read, 
> SoundOut.TargetOffsetTime, and GetNextTargetOnsetTime, but I think 
> that a sloppy way to do things.  I would generally rather let the 
> SoundOut handle the timing, and then follow that with more inline 
> code to do whatever needs doing.  Again, we need a better look at 
> your Procedure structure, you may need to revise it. 
>
> As a general strategy, I prefer to do as much as possible through the 
> program structure & object properties, and to leave less to inline code. 
>
> Regards, 
> -- David McFarlane 
>
>
> At 10/15/2013 04:56 AM Tuesday, haslinge... at gmail.com <javascript:>wrote: 
> >Hallo David 
> > 
> > 
> >I've tried another code for the changing border color part: 
> > 
> >Dim hitObject As SlideImage 
> >Set hitObject = 
> >CSlideImage(ExternalCausesSlide.States("Default").Objects(strHit)) 
> >   hitObject.BorderColor = CColor("cyan") 
> >         hitObject.Draw 
> >         Sleep 5000 
> >   hitObject.BorderColor = CColor("black") 
> > 
> > 
> >If I understood this code right, that means the color of the 
> >image,which was clicked, changes to "cyan "and after 5 sec it 
> >changes back to "black". 
> > 
> >But now I have some problems timing the change of color and the sound 
> file. 
> > 
> >At first I set "End Action" in the Slide Properties to "(none)" and 
> >"End Sound Action" in the Slide Sound Out Properties to "Terminate". 
> >Then the color was only changing after the soundfile was over. 
> > 
> >Then I changed the settings to "End Action" -> Terminate and added 
> >"Sleep 5000" in the inline code. 
> >Now the color changes immediately after clicking and stays for the 
> >5sec before changing back to black 
> >But if the Sleep Time after clicking is longer then the remaining 
> >time of the SoundOut, the SoundOut of the next Slide State isn't 
> starting. 
> > 
> >Is there any command which sets the Sleep time to something like 
> >"remaining time of SoundOut"? 
> > 
> > 
> >Best regards 
> >Hans 
>
>

-- 
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/ef0333ba-998a-4ca5-a96a-83063ad5707e%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/20131016/0ea43d12/attachment.htm>


More information about the Eprime mailing list