Notifications
Clear all
[Closed] Listbox item selection
Dec 28, 2012 10:55 pm
Hello all,
I am trying to set the viewport to the camera I select in the listbox. The error pops up on the second line inside the event. Confused in putting the “$” sign.
on lbCameras selected sel do
(
viewport.setLayout #layout_1
viewport.setCamera $lbCameras.selected)
)
2 Replies
Dec 28, 2012 10:55 pm
You’re on the right track but using the $ incorrectly. You also have a close bracket ) symbol too many. Here is some code that works. It’s not really that great because it relies on the camera name.
rollout cameraList "Camera Picker" (
listBox lbCameras "Cameras"
on lbCameras selected sel do (
viewport.setLayout #layout_1
index = findItem (for a in cameras collect a.name) lbCameras.selected
if index != 0 do viewport.setCamera cameras[index]
)
on cameraList open do (
lbCameras.items = for a in cameras collect a.name
)
)
createDialog cameraList 300 300
It might be worth using a dotNet listview or listbox and then storing the camera reference in the tag value using dotNetMxsValue.