How to set subobject properties

1 063 vues
Accéder directement au premier message non lu

JACanterbury

non lue,
1 déc. 2011, 07:18:5501/12/2011
à E-Prime
Hi,

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.

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.

Can anyone help/point me in the right direction?

Many thanks,

John

Evelina Tapia

non lue,
1 déc. 2011, 17:12:2301/12/2011
à E-Prime
John,

I use script like this:

c.SetAttrib "something", InputBox$("Enter something value that you
want to vary: ")

And then have "something" in square brackets as a property. I'd be
glad to share a script where this works in my experiment if you'd
like :)

Evelina

David McFarlane

non lue,
1 déc. 2011, 17:20:2701/12/2011
à e-p...@googlegroups.com
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

JACanterbury

non lue,
2 déc. 2011, 04:38:0702/12/2011
à E-Prime
Hi Evelina,

Thanks for your reply but I was interested to find a solution NOT
involving attributes.

eg the following will change the back colour of a slide.

dim theState as SlideState
set theState = Slide1.States("Default")
theState.BackColor = CColor("green")

I'd like to do something similar but for sub object that are on the
slide - eg images..

thanks

John

JACanterbury

non lue,
2 déc. 2011, 06:47:1902/12/2011
à E-Prime
Hi David,

Thanks for your thoughts and pointers to other resources which look
useful.

Certainly the 'attribute' approach has merits for transparency and
simplicity but as I said, I was interested to use this as an
opportunity to stretch my e-prime knowledge. I knew the information
was out there but with e-prime it seems that unless you know exactly
what you're looking for already, then finding it is harder work than
it ought to be.

I will report back when I get a solution!

cheers,

John

> <http://groups.google.com/group/e-prime/browse_thread/thread/5425e0396...>http://groups.google.com/group/e-prime/browse_thread/thread/5425e0396...
> and
> <http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870...>http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870...
> .
>
> -- David McFarlane

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message