add textdisplay to slide

608 views
Skip to first unread message

Tobias

unread,
Jul 12, 2012, 9:45:56 AM7/12/12
to e-p...@googlegroups.com
Hi,

I want to run a slide called "SearchSlide".
Within a trial, I want to add a textdisplay.

I tried:

set SearchContext
set textACC = New TextDisplay

textACC.X = "50%"
textACC.Y = "2%"
textACC.Width = "34%"
textACC.Height = "3%"
textACC.FontSize = "16"
textACC.FontName = "Arial"
textACC.backcolor = "128,128,128"
textACC.text = "correct"

however the "set" command needs an "=". How can I refer to an already existing slide?

Thanks,
Tobias

Tobias

unread,
Jul 12, 2012, 10:07:32 AM7/12/12
to e-p...@googlegroups.com
To make this more clear: I want to add a slidetext on the already existing slide.

Anne-Wil

unread,
Jul 13, 2012, 7:37:12 AM7/13/12
to e-p...@googlegroups.com
Hi Tobias,

With respect to the code that you presented now: to me it seems to define a textobject (= stand alone textbox), rather than a text-subobject to be placed within a slide-object. In order to define a textbox within a slide, I think that you need some code along the lines of: CSlideText(Slide1.States(Slide1.ActiveState).Objects("Text1")) to replace the textACC that you use now -> CSlideText(SLIDENAME.States(SLIDENAME.ActiveState).Objects("TEXTBOXNAME")).X = 50%  etc.

However: although I could imagine that it might be doable using a do-while construction, in my experience it is always way more easy to either use two separate consecutive slideobjects that are identical except the feature that you 'd like to change (i.e. the first without the textbox that is then replaced by a separate slideobject wíth the textbox -> the effect would be the same as having a textbox appear). Or, if you need more than a single change to happen (or a conditional change that you don't want to organise through slidestates on the second slide), you could opt for having a slideobject being terminated, than in an inline have it's properties changed and with a "goto label" construction go back on the procedure to before the slideobject and have the slideobject shown AGAIN (i.e. also in this case the slide is not technically altered while being shown, but altered and then shown again).

I believe that 'an E-primer' (by Michiel Spape) contains some info on these types of set-ups ( step.psy.cmu.edu/materials/EPrimer.pdf ) and there are also examples around within this group, although perhaps not the exact same thing as you search for (see for instance the fading slides thread: https://groups.google.com/forum/?fromgroups#!topic/e-prime/rY2vTRap_4Q )


Best,

AW

JACanterbury

unread,
Dec 19, 2012, 10:07:10 AM12/19/12
to e-p...@googlegroups.com
Hi Tobias,

I'm looking to do the same thing (ie add new text objects to an existing slide at runtime)

Did you work out how to do it? If so, could you post a code snippet to show how?

many thanks,

john

David McFarlane

unread,
Dec 19, 2012, 10:23:31 AM12/19/12
to e-p...@googlegroups.com
Hmm, it just occurs to me, why not just add new text to existing
SlideText sub-objects instead of adding entirely new SlideText
sub-objects at run time? Start by adding SlideText objects as
placeholders into your Slide, and into each one put an attribute
reference, e.g., [Text1], [Text2], ... Define those attributes
before running your Slide, with empty text if you do not want any
text. Then just assign new values to the attributes as needed, and
rerun or redraw the Slide to have the new text appear.

-- David McFarlane

JACanterbury

unread,
Dec 19, 2012, 10:59:48 AM12/19/12
to e-p...@googlegroups.com
Hi  David,

Thanks for the reply. The problem is that I want a generic bit of code that will read a couple of easily edited integer variables to determine how many text objects I need and to then work out how to position them (I want to create a grid of varying size and then capture which grid square the user clicks in) so I need a way to create slidetext objects at runtime and then to associate them with a particular slide.

Any more thoughts?

Many thanks,

John

David McFarlane

unread,
Dec 20, 2012, 12:45:22 PM12/20/12
to e-p...@googlegroups.com
John,

OK, that's more interesting. A few thoughts.

1) This is exactly the sort of thing where PST Web Support can help,
and you should go there first
(http://support.pstnet.com/e%2Dprime/support/login.asp ). In PST's
business model, technical support ultimately *is* their technical
documention, so don't be shy.

2) If you have EP1, then you can see how this works by looking at the
generated code -- that's how I figure out a lot of this
stuff. Simply open E-Studio, add a Slide to SessionProc, add a
couple SlideText objects to your Slide, Generate the program, then
look at the generated code in the Script window -- look in the
InitObjects() routine. Note this will not work with EP2 -- EP2 does
all this work in the new Slide1.LoadProperties routine, which makes
the generated code a lot tidier, but also hides all these important &
useful details from you. (I'm glad I still have EP1 to fall back on
for this sort of thing.)

3) You can look at the SlideText topic in the E-Basic Help facility
for some details on how to use SlideText with Slides in inline
code. But that illustrates only how to use existing SlideText
objects, not how to create & add new ones. For that, you need to
apply more general knowledge of E-Basic/VBA, and add that to
knowledge about SlideState objects.

4) This time I will spare you some trouble and go ahead and document
this a bit. I followed my own procedure in #2, and put together the
following sketch:

Dim slText as SlideText
Set slText = New SlideText
slText.Name = "Text1"
InitSlideTextDefaults slText
slText.Text = "Text"
slText.X = "10%"
slText.Y = "10%"
' more slText properties as desired...
' ...
StimSlide.States("Default").Objects.Add slText, "Text1"

This adds a SlideText item named "Text1" to the "Default" SlideState
of StimSlide -- of course, you would have to modify this to fit your
situation. The latest EP2 E-Basic Help indicates that you must also
do StimSlide.LoadProperties after all this, but that sounds wrong to
me, so you just have to sort that out on your own.

Remember that if you want to then use attribute references to control
property values of your added SlideText objects (e.g., .Text), you
will also need to add lines like

Dim slText as SlideText
Set slText = CSlideText(Slide1.States("Default").Objects("Text1"))
slText.Text = c.GetAttrib("StimAttrib")
Set slText = Nothing

or, if you prefer more compact code,

Set CSlideText(Slide1.States("Default").Objects("Text1")).Text = _
c.GetAttrib("StimAttrib")

as appropriate (and modified as needed).

I leave it to you to take it from there. Doing all this Slide
sub-object management yourself in inline code is not for the faint of heart!

-----
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 12/19/2012 10:59 AM Wednesday, JACanterbury wrote:
>Hi David,

Matthew Robison

unread,
Apr 16, 2015, 2:03:03 AM4/16/15
to e-p...@googlegroups.com
Hi David,

I know this thread is rather old, but it's been helpful for an experiment I'm designing and I have one question. I want to have a slide that collects 6 responses (mouse clicks) from 6 different grids of colored squares (3x3 grids made up of 9 different empty, colored text objects). I want to add these to the slide based on the positions of previously presented stimuli, and those attributes I've defined previously. Here is an example of what I have for adding one of these 54 items to the Slide.

Dim Test1BlueItem As SlideText
Set Test1BlueItem = New SlideText
Test1BlueItem.Name = "Test1Blue"
Test1BlueItem.Height = 19
Test1BlueItem.Width = 19
Test1BlueItem.X = c.GetAttrib("Test1BlueX")
Test1BlueItem.Y = c.GetAttrib("Test1BlueY")
Test1BlueItem.BackColor = CColor("blue")

Dim Test As SlideState
Set Test = CSlideState(TestArray.States("Default"))

Test.Objects.Add Test1BlueItem, "Test1Blue"

TestArray.LoadProperties

I have this inline after the TestArray Slide in my procedure. And I have the Slide set up as a blank screen with an infinite duration that allows for and collects 6 clicks. 

Right now it will just show the blank screen and allow the six clicks and move onto the next trial, without adding these items.

Where should I put this Inline and what might I need to add to have the Slide add these items so the subject can then click on them?

Thank you!

Matt Robison
Reply all
Reply to author
Forward
0 new messages