First time here? Check out the FAQ!

encapsulate a replicated SoundToGlobalController

+1 vote
Hello everybody, I hope all is good. already missing you all since I saw you in Busan.

I am trying to encapsulate the replication of a SoundToGlobalController, which will be part of a bigger encapsulation.

if I write a script like:

1 to: ?numberOfEvents do: [:i |

stgc start: 0s

generated Event: (?event&i) asHotValue

value: ?arrayOfvalues at: i


it works on the script, but. when I try to encapsulate the sound, I got an error message about not using hotValues in the field of a new class.

what can I do?


asked Oct 6, 2019 in Capytalk & Smalltalk by domenico-cipriani (Adept) (2,390 points)
edited Oct 6, 2019 by domenico-cipriani
Have you tried setting ?event to 0 when encapsulating? Once the class is made, you could put the correct (red) value in the field.
I just tried, and I got this error message:
The message #&, sent to 0, an instance of class SmallInteger, was not understood
When it asks for the value of ?event, try setting it to a string, for example 'anEvent'. That would let you make the class (after which you can change the parameter field type).
if I put a string I get the error message:
"Event Values (such as !anEvent2) cannot be used as parameters of a user defined class"
by trial and error, I finally found a solution that works.

?name isConcreteEvent ifTrue: [
1 to: 8 do:
    stgc start: 0 s
    event: (?name eventValue suffix2: i)
    value: (?arrayOfValues at: i)

I would like to know how this works :) thanks a lot

Please log in or register to answer this question.