Reloading DropDownList-Items

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2003   #1
Reloading DropDownList-Items

hi,

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.
 
Old 06 June 2003   #2
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).
 
Old 06 June 2003   #3
could you explain it a little bit more detailed? i'm quite new to maxscript.

do i have to copy my
Code:
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?
 
Old 06 June 2003   #4
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.

Code:
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.
 
Old 06 June 2003   #5
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!!!
 
Old 01 January 2006   #6
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.
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:01 PM.


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