I need a callback function that runs a "Function" on selection change. I am not familiar with callbacks yet and I would appreciate any help from the scriptspot community.
Thanks
JokerMartini
Forum topic · General Scripting
selection callback function
By JokerMartini · 2010-11-19
Description
Comments (2)
JokerMartini · 2010-11-21
Hey Budi G thanks for the help.
I ended up figuring it out and using implementing them into a handful of scripts these past few days. They are great. Thanks.
Budi G · 2010-11-21
first keep your mind on register callback fn ,
and after using it you need unregister callback fn.
check out the mxs reference for details.
I try to make one example:
in this forum I've made a script, there's the update buttons as manually update for user.
http://www.scriptspot.com/forums/3ds-max/general-scripting/dropdown-list…
now I will remove the update buttons and convert it to call back function.
rollout drop_roll "Drop Down List"
(
local obj_array = #()
dropdownlist obj_dd "Objects :" offset:[0,-20] items:#()
fn update_objs =
(
obj_array = objects --as array
obj_dd.items = for i in obj_array collect i.name
)
on drop_roll open do
(
update_objs()
callbacks.addScript #selectionSetChanged "drop_roll.update_objs()" id:#testcall -- register call back fn for automatically update the listbox when some object has been deleted or added
)
on obj_dd selected i do select obj_array[i]
on drop_roll close do callbacks.removeScripts id:#testcall -- unregister call back scripts when closing the dialog
)
createDialog drop_roll