CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 10-23-2006, 04:00 PM   #1
Mathieson
Frequenter
 
Mathieson's Avatar
portfolio
Mathieson Facer
Senior TA
EA
Vancouver, Canada
 
Join Date: May 2006
Posts: 289
Appending to dropdownlist.items

Hi everyone,

I am trying to append to the items parameter of a dropdownlist. My problem is that once added the dropdownlist does not display this new item in its list.

Code:
rollout ddlTrouble_gui "Dropdownlist example" ( dropdownlist ddl_example "List:" items:#("Facer") button btn_press "Press Me" on btn_press pressed do ( append ddl_example.items "FX" print ddl_example.items ) ) createDialog ddlTrouble_gui


This code is an example of what I am experiencing.

When the button is pressed it appends the string "FX" to the items parameter of the dropdowlist ddl_example and then immediately prints the contents of ddl_example.items in the listener.

You can see in the listener that it has been successfully added to the dropdownlist, but when you expand the dropdownlist there is still only one item.

Is there a refresh command for rollouts or UI items that I should be using?

Thanks,
Mathieson
 
Old 10-23-2006, 04:06 PM   #2
HalfVector
H = E + L
Jonathan Garcia
Cartagena, España
 
Join Date: Dec 2005
Posts: 216
Hi.

This should work:

Code:
on btn_press pressed do ( items = ddl_example.items append items "FX" ddl_example.items = items print ddl_example.items )


Greets.
 
Old 10-23-2006, 04:16 PM   #3
Bobo
Krakatoa Guy
 
Bobo's Avatar
Borislav Petrov
Product Specialist
Thinkbox Software
Vancouver, Canada
 
Join Date: Mar 2002
Posts: 5,322
Also see MAXScript Reference > Frequently Asked Questions > Practical Questions > Working with Scripted UI > How do I update the items in a dropdownList or listBox?
(nope, you are not the first to ask )

In the case of append, you would have to assign the result of append to the items array:

Code:
rollout ddlTrouble_gui "Dropdownlist example" ( dropdownlist ddl_example "List:" items:#("Facer") button btn_press "Press Me" on btn_press pressed do ( ddl_example.items = append ddl_example.items "FX" print ddl_example.items ) ) createDialog ddlTrouble_gui

__________________
Bobo

Last edited by Bobo : 10-23-2006 at 04:18 PM.
 
Old 10-23-2006, 04:31 PM   #4
Mathieson
Frequenter
 
Mathieson's Avatar
portfolio
Mathieson Facer
Senior TA
EA
Vancouver, Canada
 
Join Date: May 2006
Posts: 289
Thanks Bobo. Thanks HalfVector.

I thought it would be in the reference, I was just looking in the wrong places.

Thanks again guys, I really appreciate it.
 
Old 10-23-2006, 04:41 PM   #5
Bobo
Krakatoa Guy
 
Bobo's Avatar
Borislav Petrov
Product Specialist
Thinkbox Software
Vancouver, Canada
 
Join Date: Mar 2002
Posts: 5,322
Quote:
Originally Posted by FacerFX
Thanks Bobo. Thanks HalfVector.

I thought it would be in the reference, I was just looking in the wrong places.

Thanks again guys, I really appreciate it.


A link from the dropdownlist topic to the FAQ topic would have been nice.
Somebody needs to get slapped... Oh wait!
__________________
Bobo
 
Old 10-23-2006, 04:41 PM   #6
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:39 PM.


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