ScriptSpot

Forum topic · General Scripting

updating simpleMod

By jos · 2012-04-24

Description

I'm scripting a simple modifier. When picking an object i want to display the name of the picked object on the pickbutton.

on pcbSourceObj picked obj do 

doesn't work. same for (button,spinner,..) Also i want to update the modifier when changing a value.
Is there a way? Thank you


plugin simpleMod test
name:"test"
classID:#(0x7e4dd50a, 0x2577a8c0)
version:1
(
	parameters main rollout:params
	(
		spinnerval type:#radiobtnindex ui:spnTest
		sourceObj type:#node ui:pcbTest
	)
	rollout params "Mirror Parameters"
	(
		pickbutton pcbTest "pick" width:150 height:30 align:#center
		button btnTest "Test" height:30 align:#center
		spinner spnTest range:[0,100,1]
	)
	on btnUpdate pressed do print "btnUpdate pressed"
	on pcbSourceObj picked obj do print "pcbSourceObj picked"
	on spnTest changed val do print val
	on map i p do
	(
	)
)
Comments (4)

Maybe this you want

barigazy · 2012-04-24

on pcbSourceObj picked obj do
(
if obj != undefined do pcbSourceObj.text = obj.name
)

orpickbutton pcbTest "pick"

kilad · 2012-04-24

or pickbutton pcbTest "pick" width:150 height:30 align:#center autodisplay:true

 

Also i want to update the modifier when changing a value.

- it updates automatically

you can also use the [on value set do ()] event inside the parameterblock.

See scripted primitives clauses in mxshelp

thanks! the autodisplay:true

jos · 2012-04-24

thanks! the

autodisplay:true

works perfect.
when I place

on value set do (print "value set")

inside the paramterblock it doesnt print anything...

doesnt work

jos · 2012-04-24

the handler

on pcbSourceObj picked obj do

doesnt work. It doesnt print anything (see my code)