Problem addressing subobject properties
David McFarlane
mcfarla9 at msu.edu
Wed Sep 26 13:43:20 UTC 2012
Oops, I just realized that your error message did not come just from
mislepping "Text" as "Text1" -- in fact, Slides do *not* have a Text
property at all, only SlideText sub-objects have a Text property.
Sorry. And to directly access that Text property you would have to get
access to the Slide sub-object, which takes a bit of work, as explained
in the SlideText topic of the E-Basic Help facility.
But this only strengthens my main point -- by using attribute
references, you do not need access to the sub-objects at all. Attribute
references really can greatly simplify your work, well worth learning
how to use them.
-- David McFarlane
David McFarlane wrote:
> Oh, also look at this link, where I further discuss why to use attribute
> references instead of direct manipulation of object properties:
> https://groups.google.com/d/topic/e-prime/dWpfjk-BeLs/discussion
>
> -- David McFarlane
>
>
> David McFarlane wrote:
>> Katrin,
>>
>> Neither Slides nor TextDisplays have a "Text1" property, they have a
>> "Text" property, and that accounts for your error message -- see the
>> Slide topic in the E-Basic Help facility. So your lines should
>> instead read
>>
>> Slide.Text = "..."
>>
>> But if you had not made that mistake and then posted your question, I
>> would not have the opportunity to correct you bigger mistake. You
>> really should not change object properties directly in code this way,
>> for at least three reasons as I discuss at
>> https://groups.google.com/d/topic/e-prime/g1Fv2CGaSeg/discussion . As
>> I explain there, you should instead use an attribute reference. Add
>> an attribute reference (e.g., [Text]) in your Slide or TextDisplay,
>> and then your code might read
>>
>> If (c.GetAttrib("Question") = "1") Then
>> c.SetAttrib "Text", "..."
>> Else
>> c.SetAttrib "Text", "..."
>> End If
>>
>> Or if you dare, do this all in a single Iif statement,
>>
>> c.SetAttrib "Text", Iif( (c.GetAttrib("Question") = "1"), _
>> "True...", "False..." )
>>
>> -----
>> David McFarlane
>> E-Prime training online:
>> http://psychology.msu.edu/Workshops_Courses/eprime.aspx
>> Twitter: @EPrimeMaster (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 -- this is pretty
>> much their substitute for proper documentation, so make full use of
>> it. 3) In addition, PST takes questions at their Facebook page
>> (http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683
>> ), and offers several instructional videos there and on their YouTube
>> channel (http://www.youtube.com/user/PSTNET ) (no Twitter feed yet,
>> though). 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.
>> \-----------
>>
>>
>> Katrin wrote:
>>> I am stuck with a silly problem. I want to create a flexible
>>> Feedbackslide on which one Textline (of a sub object) is changing
>>> depending on an Attribute in a list before. So I used a command like
>>> If c.GetAttrib ("Question") = "1" Then
>>> Slide.Text1 = "..." Else
>>> Slide.Text1 = "..."
>>> End If
>>>
>>> But Eprime gives me an error saying that Text1 is not a an assignable
>>> property of the object.
>>> What do I do wrong?
>>> So far I always used a Textdisplay, but now I have to use a Slide (as
>>> there is sth else displayed there to) and I don't know if that
>>> changes sth/how to adress the different Textfields/subobjects on it...
>>> Thanks for your help!
>>> Katrin
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
More information about the Eprime
mailing list