View Full Version : Reloading DropDownList-Items
06-28-2003, 10:58 AM
i'm writing a script, where the material ids of an object are displayed in a dropdownlist.
if i select another object, i want to refresh the dropdownlist, so that there are the ids of the new object.
but i don't know, how to refresh the list :shrug:
any suggestions? thanks
06-29-2003, 01:44 PM
You should look into callbacks in the MAXScript help. You need to add a callback for when the selection changes to redo your dropdownlist. Something like...
callbacks.addScript #selectionSetChanged "setupDropDownList()"
which calls a function called setupDropDownList() everytime the selection set changes. All you need to do is write that routine (which you should already have most of).
06-30-2003, 07:29 AM
could you explain it a little bit more detailed? i'm quite new to maxscript.:blush:
do i have to copy my dropdownList matids "MaterialIDs" pos:[33,18] items:IDarray width:122 height:40 selection:1
from my rollout definition into the setupDropDownlist function? IDarray is the array where the material ids are written into.
my script works like this:
- 1. rollout with selectionbutton to select object
- 2. rollout with dropdownlist to choose material id
so i have to call the callbackscript in my first rollout just after selecting the object, right?
06-30-2003, 09:54 AM
OK. In brief the structure of your script will look something like this - bear with me here as I don't have MAX in front of me at the moment.
global rolloutName -- This is needed so that you can access your dropdownlist from outside of the rollout
function SetupDropDownList = (
array gathering routine
function RefreshList = (
rolloutName.matids.items = SetupDropDownList()
dropdownlist matids "MaterialIDs" pos:[33,18] width:1222 height:40
on rolloutName open do (
matids.items = SetupDropDownList()
callbacks.addScript #selectionSetChanged "RefreshList()"
I hope that makes it clearer. Callbacks are a pretty advanced topic and if you're new to MAXScript they can be quite tricky, but read the help files they tell you pretty much everything you need to know.
You'll probably also want to remove the callback once you close your rollout to stop the routine being called all the time.
06-30-2003, 04:07 PM
hey, great, thanks.:applause:
ok, it didn't work like that but your refresh-function solved my problem, too. so my script seems to go a step further until the next problem appears.:hmm:
so again, thanks a lot!!!
01-15-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.