Hi Al
> > His
> > point is instead of allowing some other object
> to get or set a
> value,
> > you should always any code that manipulates a
> property in the object
> > that defines that property.
>
> this would seem to imply that if you have a
> slider behavior that
> controls a QT behavior the slider code should
> actually be contained in
> the QT behavior. is this not correct?
I haven't followed this thread in its entirety... too busy.
However, I think you can look at a little differently Al.
You could have seperate objects that take care of the qt,
the slider thumb and each other control. The messages don't
necessarily need to be get and set directly. Your QT object
could tell the slider what percent is currently played. It
would be up to the slider object to call the necessary code
to update its position with the positional information
supplied by the call from the QT object and vice versa. Your
not directly setting anything but rather responding to an
outside "stimulus". The stimulus being the message from the
QT object that it is has played 60%, the slider or other
controls can respond to the message appropriately. In the
same way, the slider could tell the qt object that someone
has reset its position to say 30% played, its entirely up to
the QT object to interpret that message and respond
accordingly.
So going back to the qt example, lets say you have a rewind,
stop, pause, fastforward and play buttons, a slider thumb
and bar and a set of volume controls which include a slider
thumb, bar and a mute button. What messages would need to be
sent and how would they respond.
Your QT object strictly handles the QT movie properties:
a). movieTime
b). volume
c). play
d). pause
Your QT playback slider handles
a). indicator of percent played
b). someone dragging to change position
Your QT playback slider bar really only cares that
a). someone clicked at a certain location relative to its
length
Volume slider only cares about what its current percentage
of volume to max is
volume slider bar only cares about where someone might have
clicked on it relative to its length
Mute only cars whether someone has clicked on it (on or
off).
The rest of the buttons can be stupid (ie someone has
clicked on me type messages or they can be smart and disable
if 100% played (play, pause and fast forward ) or 0% played
(rewind button) or currently playing (stop button and pause
buttons).
Most of these messages can be handled with a True/False and
a float value (percent played and percent volume) and a
integer representing the amount to step forward or back
(fast forward, rewind ).
The messages sent to the QT object therefore would only need
to be along the lines of:
mHandlePercentPlayed( me, floatPercentPlayed )
mHandlePlay( me, boolPlay )
mHandleStepPlay( me, intStep ) - forward = positive,
negative = back
mHandlePause( me, boolPause )
mHandleStop( me, boolStop )
mHandlePercentVolume( me, floatPercentVolume
mHandleVolumeMute( me, boolMute )
The Quicktime object would then figure out what its
movieTime setting would be if .30 of the movie has played
out and adjust the movieTime of its Movie accordingly. The
difference being that the percent played slider would only
calculate its position along the bar and calculate what
percent that was and adjust its position accordingly then
send a message to the QT object that the percent played is
now 30%, the QT object figures out what to do with that and
makes its adjustments and sends a message back to any
related objects about whether playback is allowed and leaves
them to do whatever they desire with that information. The
path that would be wrong would be for the slider to access
the properties of the qt movie, calculate what its duration
should be and then tell the QT object to set that
movieduration or for that matter leave the QT object to
figure out that the movie has changed (since the QT object
would be monitoring the situation anyhow).
The same goes for the volume control.. a QT movie might have
a zero to 255 volume level, something else might have a 0 -
100 volume level.. it should only care that its current
position is x percentage of the allowable drag distance. It
should only send a message out if someone moves it and then
only what its new position is.. let the QT object do the
math and manipulate the volume level of the QT movie.
This way, your slider controls, play controls etc.. are
completely independent of what they are controlling they
send messages to a specified object about changes that have
occured and respond to specific stimuli ( end user mouse
events ) and perhaps some feedback event. They don't attempt
to directly modify the properties of the item (in this case
the qt movie) that they are controlling. Therefore these
sliders are completely reuseable for any other event..
controlling a QT movie, AVI movie, Flash piece, animation
playback anything.
In the same way, the qt object might send a message out to
the slider saying I'm 45% played, its up to the slider to
calculate its own position and store data based on that if
it so desires. The rewind button might send a message to jog
backwards by a predefined step of 10, the QT object sets the
QT movies position, calculate the percent played and sends a
message to the slider to say hey I'm x% played, it would
then be up to the slider to calculate its own position and
adjust accrodingly.
There is no need for a get/set situation, your passing a
useable parameter and allow the other object class to deal
with it as it sees fit. What happens within the other object
is non of the message senders business. In this manner, you
still communicate but you pass simple values that the other
object acts upon in greater detail.. you don't directly
manipulate what the other object is in charge of etc..
therefore you also have a degree of ease in debugging
because you have a small predefined message paths and you
can see who is calling in where etc..
Does this make any sense or am I totally missing the boat on
what is being talked about.
Sincerely
Mark R. Jonkman
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]