[Newbies] Re: SimpleSliderMorph target setting question.
peace_the_dreamer at yahoo.com
Mon Nov 24 02:24:14 UTC 2008
[Newbies] SimpleSliderMorph target setting question.
>Tim Patti timpatti at yahoo.com
>Fri Nov 21 01:34:21 UTC 2008
>Hi all, I've been stuck for a couple of days on trying to figure out how to
>properly set the target and setValueSelector of a SimpleSliderMorph. My
>intended target is an instance of a class that I created in the workspace and
>I assume the setValueSelector is what I use to send the value to a method in
>my instance of the class.
See Torsten Bergmann's note for a progammatic way to set things.
For a one off, in the field testing, sort of way...
For classes with morphic representations you can:
grab a slider from the parts bin
Bring up its halo.
Select the red menu.
Make it stay up.
Set the action selector to 'setTurns:'.
Set the maximum and minimum range.
Set truncation on to avoid fractional values.
Sight target to select a target.*
*(If you are not offered this option,
then you are using a sqeauk earlier than 3.9
without some essential targeting fixes.
If thats the case Torsten's methods will still work.)
>si := SecondaryCoil. "make an instance of the class"
>si setTurns:10."set the turns to 10"
>Transcript show: si getTurns."print the turns"
>The above code works in the workspace and transcript, but I cannot figure out
>how to point the SimpleSliderMorph target to my instance si. Tried all kind
>of combinations with no luck.
In the workspace you can create the slider
SimpleSliderMorph new openCenteredInWorld .
mySlider target: si
alternately from the workspace menu
check the box for
'create textual references to dropped morphs'.
Then drag your slider over and drop it on the window.
>I'd like to be able to use the slider to set the turns of the coil in my
>instance of SecondaryCoil.
>I have 4 books on Squeak but I must me missing something obvious here.
More information about the Beginners