Reloading DropDownList-Items

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  06 June 2003
Reloading DropDownList-Items


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

any suggestions? thanks

Last edited by mdcorp : 06 June 2003 at 11:02 AM.
  06 June 2003
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 June 2003
could you explain it a little bit more detailed? i'm quite new to maxscript.

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 June 2003
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

   return newArray

function RefreshList = (
   rolloutName.matids.items = SetupDropDownList()

rollout rolloutName
   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 June 2003
hey, great, thanks.
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.

so again, thanks a lot!!!
  01 January 2006
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:54 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.