viernes, 21 de junio de 2019

Como Crear Efectos en VFP

Efectos Visual Foxpro



Me preguntaban que si era posible el poder realizar unos efectos en visual foxpro y les mencione de que si era probable hacer estos tipos de efectos y se me ocurrió realizar este pequeño ejemplo para hacérselo llegar a ustedes y poder demostrar de que si se puede hacer algo si uno se lo propone.

Este ejemplo es simplemente como una demostración de lo que se puede hacer en este lenguaje y que si quieren  profundizar mas en el campo ya tendrán una herramienta de como poder realizar estos tipos de efectos.

Acá simplemente jugamos a hacer aparecer un número de etiquetas, que dependiendo del tamaño del texto irán apareciendo.

No se me ocurrió otra forma de realizarlo, pero de seguro lo habrá. He utilizado un total de once(11) etiquetas para realizar estos efectos.

En primer lugar cuando se introduzca el texto,este aparecerá de manera escalonada e irá apareciendo progresivamente de manera lineal.

El texto no debe tener un máximo de once(11) caracteres , y si le quieres agregar más tendrás que realizar ciertos arreglos al programa para tu conveniencia.

En la parte principal del programa deberemos colocar lo siguiente:

Los pasos a seguir son realmente pocos, pero empezaremos con el inicio del formulario agregando el siguiente código :

SET TALK OFF
SET CONFIRM ON
PUBLIC arreglo,xlen,sw
sw=0
xlen=0
DECLARE arreglo[20]
FOR v=1 TO 20
   arreglo[v]=""
NEXT v
thisform.label1.Left=20
thisform.label2.Left=20
thisform.label3.Left=20
thisform.label4.Left=20
thisform.label5.Left=20
thisform.label6.Left=20
thisform.label7.Left=20
thisform.label8.Left=20
thisform.label9.Left=20
thisform.label10.Left=20
thisform.label11.Left=20

thisform.apago

En el Metodo apago agregaremos :

thisform.label1.Visible =.f.
thisform.label2.Visible =.f.
thisform.label3.Visible =.f.
thisform.label4.Visible =.f.
thisform.label5.Visible =.f.
thisform.label6.Visible =.f.
thisform.label7.Visible =.f.
thisform.label8.Visible =.f.
thisform.label9.Visible =.f.
thisform.label10.Visible =.f.

thisform.label11.Visible =.f.

En el Lostfocus del Text1 colocamos el siguiente código :

Thisform.apago
xlen=Len(Alltrim(Thisform.text1.Value))
For i=1 To xlen
arreglo[i]=Substr(Thisform.text1.Value,1,xlen)
Next i
For j=1 To xlen
If j=1
r1=Rand()+60
Thisform.label1.Visible =.T.
Thisform.label1.Top =r1
Thisform.label1.Left =r1
Thisform.label1.FontSize =9
Thisform.label1.Caption =Substr(arreglo[j],1,1)
Endif
If j=2
r2=Rand()+70
Thisform.label2.Visible =.T.
Thisform.label2.Top =r2
Thisform.label2.Left=r2
Thisform.label2.FontSize =9
Thisform.label2.Caption =Substr(arreglo[j],2,1)
Endif
If j=3
r3=Rand()+80
Thisform.label3.Visible =.T.
Thisform.label3.Top =r3
Thisform.label3.Left=r3
Thisform.label3.FontSize =9
Thisform.label3.Caption =Substr(arreglo[j],3,1)
Endif
If j=4
r4=Rand()+90
Thisform.label4.Visible =.T.
Thisform.label4.Top =r4
Thisform.label4.Left=r4
Thisform.label4.FontSize =9
Thisform.label4.Caption =Substr(arreglo[j],4,1)
Endif
If j=5
r5=Rand()+100
Thisform.label5.Visible =.T.
Thisform.label5.Top =r5
Thisform.label5.Left=r5
Thisform.label5.FontSize =9
Thisform.label5.Caption =Substr(arreglo[j],5,1)
Endif
If j=6
r6=Rand()+110
Thisform.label6.Visible =.T.
Thisform.label6.Top =r6
Thisform.label6.Left=r6
Thisform.label6.FontSize =9
Thisform.label6.Caption =Substr(arreglo[j],6,1)
Endif
If j=7
r7=Rand()+120
Thisform.label7.Visible =.T.
Thisform.label7.Top =r7
Thisform.label7.Left=r7
Thisform.label7.FontSize =9
Thisform.label7.Caption =Substr(arreglo[j],7,1)
Endif
If j=8
r8=Rand()+130
Thisform.label8.Visible =.T.
Thisform.label8.Top =r8
Thisform.label8.Left=r8
Thisform.label8.FontSize =9
Thisform.label8.Caption =Substr(arreglo[j],8,1)
Endif
If j=9
r9=Rand()+140
Thisform.label9.Visible =.T.
Thisform.label9.Top =r9
Thisform.label9.Left=r9
Thisform.label9.FontSize =9
Thisform.label9.Caption =Substr(arreglo[j],9,1)
Endif
If j=10
r10=Rand()+150
Thisform.label10.Visible =.T.
Thisform.label10.Top =r10
Thisform.label10.Left=r10
Thisform.label10.FontSize =9
Thisform.label10.Caption =Substr(arreglo[j],10,1)
Endif
If j=11
r11=Rand()+160
Thisform.label11.Visible =.T.
Thisform.label11.Top =r11
Thisform.label11.Left=r11
Thisform.label11.FontSize =9
Thisform.label11.Caption =Substr(arreglo[j],11,1)
Endif

Next j
Inkey(3)
t_tope=Thisform.label1.Top
t_left=Thisform.label1.Left
For j=1 To xlen
If j=1
Thisform.label1.Top =t_tope
Thisform.label1.Left =t_left
Thisform.label1.FontSize =9
Thisform.label1.Caption =Substr(Trim(arreglo[j]),1,1)
Endif
If j=2
Inkey(0.3)
Thisform.label2.Top =t_tope
t_left=t_left+30
Thisform.label2.Left =t_left
Thisform.label2.FontSize =9
Thisform.label2.Caption =Substr(Trim(arreglo[j]),2,1)
Endif
If j=3
Inkey(0.3)
Thisform.label3.Top =t_tope
t_left=t_left+30
Thisform.label3.Left =t_left
Thisform.label3.FontSize =9
Thisform.label3.Caption =Substr(Trim(arreglo[j]),3,1)
Endif
If j=4
Inkey(0.3)
Thisform.label4.Top =t_tope
t_left=t_left+30
Thisform.label4.Left =t_left
Thisform.label4.FontSize =9
Thisform.label4.Caption =Substr(Trim(arreglo[j]),4,1)
Endif
If j=5
Inkey(0.3)
Thisform.label5.Top =t_tope
t_left=t_left+30
Thisform.label5.Left =t_left
Thisform.label5.FontSize =9
Thisform.label5.Caption =Substr(Trim(arreglo[j]),5,1)
Endif
If j=6
Inkey(0.3)
Thisform.label6.Top =t_tope
t_left=t_left+30
Thisform.label6.Left =t_left
Thisform.label6.FontSize =9
Thisform.label6.Caption =Substr(Trim(arreglo[j]),6,1)
Endif
If j=7
Inkey(0.3)
Thisform.label7.Top =t_tope
t_left=t_left+30
Thisform.label7.Left =t_left
Thisform.label7.FontSize =9
Thisform.label7.Caption =Substr(Trim(arreglo[j]),7,1)
Endif
If j=8
Inkey(0.3)
Thisform.label8.Top =t_tope
t_left=t_left+30
Thisform.label8.Left =t_left
Thisform.label8.FontSize =9
Thisform.label8.Caption =Substr(Trim(arreglo[j]),8,1)
Endif
If j=9
Inkey(0.3)
Thisform.label9.Top =t_tope
t_left=t_left+30
Thisform.label9.Left =t_left
Thisform.label9.FontSize =9
Thisform.label9.Caption =Substr(Trim(arreglo[j]),9,1)
Endif
If j=10
Inkey(0.3)
Thisform.label10.Top =t_tope
t_left=t_left+30
Thisform.label10.Left =t_left
Thisform.label10.FontSize =9
Thisform.label10.Caption =Substr(Trim(arreglo[j]),10,1)
Endif
If j=11
Inkey(0.3)
Thisform.label11.Top =t_tope
t_left=t_left+30
Thisform.label11.Left =t_left
Thisform.label11.FontSize =9
Thisform.label11.Caption =Substr(Trim(arreglo[j]),11,1)
Endif
Next j
Thisform.Refresh

La variable xlen es quién realmente nos indica las etiquetas que debemos mostrar en el formulario.

Espero les resulte de gran ayuda para sus próximos proyectos.














0 comentarios:

Publicar un comentario