Using Director > Behaviors > Creating an on getPropertyDescriptionList handler

 

Creating an on getPropertyDescriptionList handler

To build a list of properties for a behavior, add each property to the list that the on getPropertyDescriptionList handler returns. Then use the return command to return the list.

For example, this handler creates a property list named Description that contains the definitions for movement and whichSound:

on getPropertyDescriptionList

	set description = [:]

	addProp description, #Movement, [#default: 5, 	#format:#integer, #comment: ¬
	"Set motion to the right:", #range: [#min:1, #max:10]]

	addProp description, #noise, [#default:"", format: #sound, ¬
	#comment:"Sound cast member name"]

	return description

end

Alternatively, you can use this syntax to do the same as the previous handler:

on getPropertyDescriptionList

	return [¬
	
	#Movement: [#default: 5, #format:#integer, #comment: ¬
	"Set motion to the right:", #range: [#min:1, #max:10]],

	#noise: [#default:"", format: #sound, ¬
	#comment:"Sound cast member name"]
	]
	
end