How to set subobject properties
David McFarlane
mcfarla9 at msu.edu
Thu Dec 1 22:20:27 UTC 2011
John,m
At 12/1/2011 07:18 AM Thursday, you wrote:
>I want to set subobject properties on the fly rather than hard code
>them in the properties box. (eg set an image's size and position on a
>slide object)
>
>I suppose I could define extra attributes in the list and set their
>values with setattrib() and then in the properties box for the image
>refer to [width] etc but I'd like to use this as an opportunity to
>learn a bit more.
Well, this is already the correct solution, for at least three reasons...
(1) Using attribute references documents your parameter values in the
logged data file. Presumably, you want those values logged with the
data anyway. In that case, you will already use c.SetAttrib just to
log the values (BTW, you do *not* need to create attributes in a List
before you set them with c.SetAttrib, just go right ahead and use
c.SetAttrib in inline code), and as long as your program does that
already, you might as well just use those as an attribute references
(e.g., "[width]") to manipulate sub-object properties.
(2) Using attribute references better documents what happens within
your sub-objects. If you start monkeying with sub-object properties
directly with code, then nothing in the sub-object itself will
reflect that, which could be misleading to anyone who later looks at
your program (including you two weeks from now). It is poor
programming practice to obfuscate program behavior like that. If you
use an attribute reference in your sub-object property, then that
alerts the reader that that value is subject to change, and to look
for the definition of the attribute somewhere else in the program.
(3) It is usually easier and cleaner to manipulate sub-object
properties by means of attribute references rather than directly. In
fact, I would hazard that the designers of E-Prime specifically added
this facility as a convenience to users, so to circumvent that rather
destroys the purpose of the facility -- it would be like getting an
underground garden sprinkler system installed, and then asking,
"Where is the garden hose, and how do I hook it up to the
spigot?" Remember, for better or worse, this is E-Prime, *not* pure
VBA (much less C or C++).
Nevertheless, you might have a legitimate reason to manipulate
sub-objects directly in code, or you might just be determined to do
things the wrong way. In that case...
>The Reference manual lists loads of funciton s eg CSlideImage but I
>can't find any documentation any where that explains what they do or
>how to use them.
Contrary to what you may expect based on the title, the "Reference
Guide" is *not* the E-Prime technical reference. You will find what
counts as a technical reference in the E-Basic Help facility, which
you may access from the Help menu in E-Studio, or from the E-Prime
menu off the Windows Start menu. Slide sub-object topics (e.g.,
SlideText) there will include examples of E-Basic code. Bear in
mind, however, that the E-Prime documentation is incomplete, and
sometimes misleading or just plain wrong, so keep your wits about you
and test everything for yourself.
>Can anyone help/point me in the right direction?
See also my two essays at
<http://groups.google.com/group/e-prime/browse_thread/thread/5425e03968cab428>http://groups.google.com/group/e-prime/browse_thread/thread/5425e03968cab428
and
<http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870b723fc3>http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870b723fc3
.
-- David McFarlane
--
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 this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list