Notifications
Clear all
[Closed] show/hide user-interface controls based on dropdownlist selection
Nov 11, 2009 4:41 pm
I’m having a hard time getting my on selected to work…I dunno what I’m doing wrong, and I’m pretty sure it has something to do with scope…Is this something that can be easily solved? I want all the additional interface elements to appear once the user selects custom in the dropdown. If they select anything besides custom then the rest should be invisible. But its not doing it
plugin Helper XPlaneObj8Light
name:"X-Plane Light"
classID:#(0x44b32286, 0x7d6d25b6)
extends:Dummy
(
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 selected drpLightName 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
)
)
)
)
4 Replies
Nov 11, 2009 4:41 pm
Is there anything in the above code that would prevent the .LightName parameter of the helper from having the value of the currently selected dropdownlist item? All my values are readable except that one. I’m tempted to have a hidden edittext box and in my on selected action, I copy the value to that, but that seems excessive… Any ideas?