Notifications
Clear all

[Closed] assign CA using editText…

doorDataCA = attributes doorData
 (
 	parameters main rollout:params
 	(
 		dtag type:#integer ui:dtag
 		manu type:#string ui:manufa
 	)
 
 	rollout params "BIM Parameters" width:162 height:93
 	(
 		spinner dtag "Tag: " pos:[52,7] width:97 height:16 range:[1,1000,1] type:#integer
 		editText manufa "Manufacturer:" width:140 height:16 labelOnTop:true
 		
 		on manu entered i do
 		(
 			node.manu = manufa.text
 		)
 	)
 )
 		custAttributes.add $sphere001 doorDataCA

Did you read my post #11? You don’t need:

on manu entered i do
 		(
 			node.manu = manufa.text
 		)

Now you have correctly labelled your rollout controls they are wired automatically.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

you are absolutely right. you can link a string parameter and edittex UI control. It’s one of not documented features. I might be wrong but this feature was not available since version 2009.
for me there is a reason of not using this link. the problem is that any edittext change goes to undo list (not just entered, but every symbol change) .
without parameter linking i can do only entered change undoable. also it helps me query the value before assigning it to the parameter.

what should I be using at:

on manu entered i do

to have the CA stored when pressing the enter key at the end of the string instead of individual key typing (this kills the undo list…)?

Hey Raytracer05,
when I remove the lines values do not hold again… :hmm:

@Raytracer05
yes, sorry for the confusion, you are absolutely right.
the code is not needed.

@denisT
sorry I can’t understand the workaround you are suggesting in regards to the edittext change goes to undo list issue.

Thanks again.

something like this:

delete objects
s = sphere isselected:on

doorDataCA = attributes doorDataCA
(
	parameters main rollout:params
	(
		manufacturer type:#string --ui:ui_manufacturer
		on manufacturer set val do
		(
			if val == undefined do val = ""
			this.params.ui_manufacturer.text = val
		)
	)
	
	rollout params "Parameters"
	(
		editText ui_manufacturer "Manufacturer: " text:(if iskindof manufacturer String then manufacturer else "") \
			width:140 align:#left offset:[-4,0] labelOnTop:on
		on ui_manufacturer entered val do undo "It's enetered" on
		(
			if val != "" do manufacturer = val
		)
	)
)
custAttributes.add s doorDataCA baseobject:on 
  

thank you. curious that the cursor goes back at the beginning of the string at enter… differently than the typical behavior of fields.

I also don’t understand exactly why ui:ui_manufacturer can be commented but it certainly works!

what should I be using at:

on manu entered i do

to have the CA stored when pressing the enter key at the end of the string instead of individual key typing (this kills the undo list…)?
Sorry I didn’t get what you meant by this. I see what you mean now though, every character entered is a separate undo which is a pain.

I also don’t understand exactly why ui:ui_manufacturer can be commented but it certainly works!

That is the part that creates the link between the parameter and the rollout control and causes the problem with the undo.

manufacturer type:#string ui:ui_manufacturer

The code above (without commenting out) declares a parameter ‘manufacturer’, tells Max it’s a #string and to link it directly to the rollout control ‘ui_manufacturer’. This is how I had it working in post #11 but as you discovered updates with every key press. It has been commented out to stop this unwanted behaviour and since you are linking it manually isn’t needed. You could delete it altogether if you want.

For the clear explanation.

Page 2 / 2