PDA

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


RogerBlasco
11-23-2010, 11:22 PM
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

labbejason
11-24-2010, 12:02 AM
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.

RogerBlasco
11-24-2010, 12:31 AM
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!

CGTalk Moderation
11-24-2010, 12:31 AM
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.