Updating Listboxes? Argument count error: append wanted 2, got 1

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 11 November 2010   #1
Updating Listboxes? Argument count error: append wanted 2, got 1

Hello, unfortunately I've had a rough time with Maxscript. I am used to, a different type of programming language so any help would be much appreciated, but I have an idea of what I want to do and have been testing aspects of maxscript to see how far it cane take me, I altered the script to the below so that the information collected from netManager is updated into the listbox's (that is what I was trying to do with Append) but I can't get it to work... Is there is a simple way to update a listbox?

I get "Argument count error: append wanted 2, got 1" as the answer, the debugger doesn't not seem very remunerative but it could just be my simple misunderstanding, the code is below, written by me, please let me know if anyone could help me out with this...

Thank you.

/* category:"Utilities"
toolTip:"Net Render Controller"
*/

global jobs_list = #()
global server_list = #()

rollout listOfJobs "list of jobs"
(

button connectbtn "connect"
on connectbtn pressed do (
Manager = NetRender.GetManager()
Manager.connect #manual "100.100.100.18"
Manager.GetControl()
Manager.SetUpdates false
jobs = Manager.GetJobs()
servers = Manager.GetServers()
Manager.setupdates true
jobs_list = for i in jobs collect (i.name)
server_list = for i in servers collect (i.name)

jobList.items = append jobs_list
serverList.items = append server_list
)


button disconnectbtn "disconnect"
on disconnectbn pressed do (
Manager.Disconnect()
listbox serverList.array = #()
)


listbox jobList "Jobs:" items:(jobs_list)

listbox serverList "Servers:" items:(server_list)

)

createDialog listOfJobs
 
Old 11 November 2010   #2
Not getting any errors with this:

/* category:"Utilities"
 toolTip:"Net Render Controller"
 */
 
 (
 	rollout listOfJobs "list of jobs"
 	(
 		local jobs_list = #()
 		local server_list = #()
 		
 		button connectbtn "connect"
 		button disconnectbtn "disconnect"
 		listbox jobList "Jobs:" items:(jobs_list)
 		listbox serverList "Servers:" items:(server_list)
 		
 		on connectbtn pressed do 
 		(
 			Manager = NetRender.GetManager()
 			Manager.connect #manual "100.100.100.18"
 			Manager.GetControl()
 			Manager.SetUpdates false
 			jobs = Manager.GetJobs()
 			servers = Manager.GetServers()
 			Manager.setupdates true
 			jobs_list = for i in jobs collect (i.name)
 			server_list = for i in servers collect (i.name)
 			jobList.items = jobs_list
 			serverList.items = server_list
 		)
 
 		on disconnectbn pressed do 
 		(
 			Manager.Disconnect()
 			listbox serverList.array = #()
 		)
 	)
 
 	createDialog listOfJobs
 )


Your error is referring to the append method. Append requires: <array> <value>, you were only providing the value. To populate one of the listbox.items, just pass it an array.
__________________
www.jasonlabbe3d.com

Last edited by labbejason : 11 November 2010 at 12:06 AM.
 
Old 11 November 2010   #3
Ahhh how stupid of me - append was just a complication... I also see the tidiness of what you did with my little code and without the global... hmmm... I tried it, it works and now I can continue. I appreciate this greatly thank you very much!
 
Old 11 November 2010   #4
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
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 05:23 AM.


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