- VERSION 4.07.24.EP

- Se agregó nuevamente el scrollview a "agregaPreguntaAbierta", para que cuando sean muchas preguntas, no se salga de la pantalla el panel.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-07-25 13:44:10 -06:00
parent 731a37ccb4
commit abb1c48b3c
5 changed files with 38 additions and 26 deletions

View File

@@ -167,6 +167,8 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
Log("Iniciamos PreguntaAbierta")
Log(ids)
Log(respuestas)
Private sv_cuest As ScrollView
sv_cuest.Initialize(500dip)
encuestaIniciada = True
vPreguntaActual = id
bAceptarPregunta.Initialize("bAceptarPregunta")
@@ -178,6 +180,11 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
panelSombra.Background = cd
Private panelX As Panel 'Panel de la pregunta.
panelX.Initialize("pQuest")
Private sv_cuest As ScrollView
sv_cuest.Initialize(100dip)
Private panel2 As Panel 'Panel de la pregunta.
panel2.Initialize("panel2")
panel2.Color = Colors.Yellow
panelActual = panelX
Private lbl As Label 'Etiqueta de la pregunta.
lbl.Initialize("")
@@ -201,23 +208,29 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
labelX(p).As(B4XView).SetTextAlignment("CENTER", "CENTER")
et(p).SetTextSizeAnimated(0, 14)
et(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":ids.Get(p))
' Log($"Agregamos ET ${p}"$)
panelX.AddView(labelX(p), 10dip, (70 * (p + 1)), (panelX.Width * 0.75), 60) 'Agregamos la etiqueta al panel.
panelX.AddView(et(p), (labelX(p).Width + 10), (70 * (p + 1)), (panelX.Width * 0.2), 60) 'Agregamos el edittext al panel.
et(p).Text = ""
labelX(p).Text = respuestas.Get(p)
Private newTop As Int = lbl.top + lbl.Height + 20 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
et(p).Text = ""
Log($"Agregamos ET ${labelX(p).text} - ${(70*p)}"$)
sv_cuest.panel.AddView(labelX(p), 0, (70 * p), (panelX.Width * 0.72), 60) 'Agregamos la etiqueta al panel.
sv_cuest.panel.AddView(et(p), (labelX(p).Width + 5), (70 * p), (panelX.Width * 0.2), 60) 'Agregamos el edittext al panel.
Private newTop As Int = 0 'lbl.top + lbl.Height + 20 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
If p <> 0 Then newTop = et(p - 1).Top + et(p - 1).Height + 5 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
et(p).Top = newTop
labelX(p).Top = newTop
Next
bAceptarPregunta.Text = "Continuar"
' panelX.AddView(bAceptarPregunta, 10, newTop + r(respuestas.Size - 1).Height + 20, 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
panelX.AddView(bAceptarPregunta, 10, newTop + 80 + 15, 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
panelX.AddView(sv_cuest, 10, lbl.top + 45dip, (panelX.Width * 0.95), 300dip)
sv_cuest.panel.Height = newTop + 40dip
panelX.Height = newTop + 80dip + 35dip 'Calculamos el alto del panel de acuerdo al Top del boton.
If panelX.Height > (Root2.Height * 0.7) Then ' Si el panel es mayor al 70%, lo regresamos al 70%.
panelX.Height = Root2.Height * 0.7
End If
panelX.AddView(bAceptarPregunta, 10, (panelX.Height - 55dip), 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
bAceptarPregunta.Left = (panelX.Width / 2) - (bAceptarPregunta.Width / 2)
panelX.Height = bAceptarPregunta.Top + bAceptarPregunta.Height + 15dip 'Calculamos el alto del panel de acuerdo al Top del boton.
sv_cuest.Height = panelX.Height - (lbl.Top + lbl.Height) - 55dip
panelX.left = (Root2.Width / 2) - (panelX.Width / 2)
panelX.top = (Root2.Height / 3) - (panelX.Height / 2)
panelX.top = (Root2.Height / 2) - (panelX.Height / 2) 'Centramos verticalmente el panel.
If respuestas.Size < 10 Then panelX.top = (Root2.Height / 3) - (panelX.Height / 2) ' Si hay mas de 9 productos en la lista, ponemos el panel a 1/3 de altura
panelSombra.Width = Root2.Width
panelSombra.Height = Root2.Height
panelSombra.Elevation = 100dip