Notifications
Clear all

[Closed] dropdownlist selected value as property of scripted plugin helper

I have a scripted plugin extending a point helper…

There’s a dropdownlist with a bunch of string values in it, and I have the property set to the right ui name…but when I evaluate the helper in my export script, the LightName property is empty. Do I have to manually assign the selected value to the property in the on selected action?


plugin Helper XPlaneObj8Light
	name:"X-Plane Light"
	classID:#(0x44b32286, 0x7d6d25b6)
	extends:Point
(
	parameters main rollout:XPlaneObj8LightParams
	(
		LightName	type:#string	ui:drpLightName
		RValue	type:#float	ui:spnR
		GValue	type:#float	ui:spnG
		BValue	type:#float	ui:spnB
		AValue	type:#float	ui:spnA
		SizeValue	type:#float	ui:spnSize
		S1Value	type:#float	ui:spnS1
		T1Value	type:#float	ui:spnT1
		S2Value	type:#float	ui:spnS2
		T2Value	type:#float	ui:spnT2
		simDataRef	type:#string	ui:txtDataRef	default:"sim/"
	)
	rollout XPlaneObj8LightInfo "X-Plane Light" width:162 height:319
	(
	label lab1 "This helper marks the"
	label lab2 "location of a light of"
	label lab3 "either named or custom"
	)
	rollout XPlaneObj8LightParams "Light Parameters" width:162 height:319
	(
	dropdownlist drpLightName "Named Light Selection" items:#("airplane_landing", "airplane_landing0", "airplane_landing1", "airplane_landing2", "airplane_landing3", "airplane_taxi", "airplane_beacon", "airplane_nav_tail", "airplane_nav_left", "airplane_nav_right", "airplane_strobe", "custom")
	label lab4 "Custom Light Parameters" visible:false
	spinner spnR "R: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnG "G: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnB "B: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnA "A: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnSize "Size: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnS1 "S1: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnT1 "T1: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnS2 "S2: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	spinner spnT2 "T2: " range:[-9999,9999,0] scale:0.1 fieldwidth:50 visible:false
	edittext txtDataRef "Sim DataRef: " fieldwidth:135 labelOnTop:true visible:false
	on drpLightName selected i do
	(
		if drpLightName.items[i] == "custom" then
		(
			lab4.visible = true
			spnR.visible = true
			spnG.visible = true
			spnB.visible = true
			spnA.visible = true
			spnSize.visible = true
			spnS1.visible = true
			spnT1.visible = true
			spnS2.visible = true
			spnT2.visible = true
			txtDataRef.visible = true
		) else (
			lab4.visible = false
			spnR.visible = false
			spnG.visible = false
			spnB.visible = false
			spnA.visible = false
			spnSize.visible = false
			spnS1.visible = false
			spnT1.visible = false
			spnS2.visible = false
			spnT2.visible = false
			txtDataRef.visible = false
		)
	)
	)
)

3 Replies

If you set LightName type to #integer ,you get the index of selected dropdown item. I don’t know if you can get the actual text.

Hmmm…

Is it possible to set a edittext box and make it hidden…and in my on selected, I set the value of the edittext to the text of the selected item? I can then set my parameter to the ui of the edittext.

I got it to sorta work using an edittext. Which gives the user the ability to type in the name…but I don’t care for this method.

I also need to figure out how to get it to set the dropdownlist to the existing value when you load a file saved with this helper.