Issues With ListBox and Custom Attributes

For Some reason I'm having a hard time getting the listBox with in a custom attribute show its items. I can add them just fine and when i look up the array with in the listener the information is there, but when I look at the list Box it is empty

ah=(EmptyModifier())
caDef = attributes caName
(
	Parameters Params Rollout:RO
	(
		refNodes type:#maxObjectTab tabsize:0 tabsizeVariable:true
	)--end Paramaters
 
	Rollout RO "Test"
	(
		ListBox P_list "List"
		editText P_Name "Name"
		button P_Add "Add" across:2 
 
		on P_add pressed do
		(
			append P_list.items P_Name.text
		)
	)--end Rollout
)--end Custom Attribute
 
addModifier $ ah
custAttributes.add ah caDef
 
append AH.refNodes (nodeTransformMonitor node:$ forwardTransformChangeMsgs:false)

For now this is a simple example but i can not get it to work properly. Am I missing information somewhere like within the paramater block or does listBox just not like Custom Attributes.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Videep's picture

The Correct Code

Hey Everything is fine in your code except the APPEND line...

Correct code copy and paste:

caDef = attributes caName
(
Parameters Params Rollout:RO
(
refNodes type:#maxObjectTab tabsize:0 tabsizeVariable:true
)--end Paramaters

Rollout RO "Test"
(
ListBox P_list "List"
editText P_Name "Name"
button P_Add "Add" across:2

on P_add pressed do
(
P_list.items = append P_list.items P_Name.text
)
)--end Rollout
)--end Custom Attribute

Marco Brunetta's picture

I think the problem is that

I think the problem is that to see the update in the listbox you need to update the items variable with a new array, instead of just appending items. Check out "How do I update the items in a dropdownList or listBox?" in the maxscript reference.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.