Notifications
Clear all
[Closed] change edittext on selection change
May 26, 2006 3:26 pm
Hi all,
Is there any way to detect a selection change. I’ve build a tool that gets the selection.name and puts it in a edittext box. But how can i make it active so that is changes every time i select a different object?
Is there something similar to filepostopen?
thanks
1 Reply
1 Reply
Yes, there is a callback called #selectionSetChanged
(
global test_rollout
try(destroyDialog test_rollout)catch()
rollout test_rollout "Selection Monitor"
(
edittext edt_selection "Selection"
fn updateSelection =
(
txt = ""
for o in selection do txt += o.name + " | "
edt_selection.text = txt
)
on test_rollout open do
(
callbacks.addScript #selectionSetChanged "test_rollout.updateSelection()" id:#testSelectionSetMonitor
updateSelection()
)
on test_rollout close do
callbacks.removeScripts id:#testSelectionSetMonitor
)--end rollout
createDialog test_rollout 400 40
)
You could replace the content of the updateSelection function with
fn updateSelection =
(
if selection.count == 1 then
edt_selection.text = $.name
else
edt_selection.text = selection.count as string + " Objects Selected."
)
to get one name or a number when multiple or none are selected…