Poco a poco

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
LOUIS
Posts: 234
Joined: Tue Dec 11, 2012 9:05 pm
DBs Used: DBF

Poco a poco

Post by LOUIS »

Hola Amigos

Necesito una ayudita por favor ... Muestro una imagen en pantalla y las cubro con labels, al ir destapando (ocultando) una por una las labels, me debería ir mostrando poco a poco la imagen del fondo, pero no es así :oops:
Me oculta todas las labels y al final me muestra la imagen zas de golpe !
Yo quisiera ir mostrando la imagen cuadro por cuadro, no sé que estoy haciendo mal :|

Code: Select all

#include "hmg.ch"

FUNCTION Main()

DEFINE WINDOW MAIN AT 0,0 WIDTH 600 HEIGHT 500 BACKCOLOR BLUE MAIN

   @ 0,0 IMAGE FOTO PICTURE "CAR.JPG" WIDTH 600 HEIGHT 400 STRETCH
        
   @ 000,000 LABEL L1 WIDTH 300 HEIGHT 200 BACKCOLOR WHITE
   @ 000,300 LABEL L2 WIDTH 300 HEIGHT 200 BACKCOLOR WHITE
   @ 200,000 LABEL L3 WIDTH 300 HEIGHT 200 BACKCOLOR WHITE
   @ 200,300 LABEL L4 WIDTH 300 HEIGHT 200 BACKCOLOR WHITE

   @ 425,250 BUTTON VER CAPTION "Mostrar Imagen" ONCLICK VEA()

END WINDOW

MAIN.CENTER
ACTIVATE WINDOW MAIN

RETURN


*-----------
FUNCTION VEA

FOR i=1 TO 4
    IF i = 1
       MAIN.L1.HIDE
    ELSEIF i = 2
       MAIN.L2.HIDE
    ELSEIF i = 3
       MAIN.L3.HIDE
    ELSEIF i = 4
       MAIN.L4.HIDE
    ENDIF
    INKEY(1)
NEXT

RETURN
Esperaré alguna ayudita ...

Saludos y gracias por anticipado.
Louis

P.D.- Adjunto la imagen.
Attachments
CAR.rar
(80.32 KiB) Downloaded 14 times
edk
Posts: 954
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Poco a poco

Post by edk »

If you want an events to be executed during a program loop, you should use Do Events command.
The effect will also be better when you use ReDraw method

Code: Select all

*-----------
FUNCTION VEA

FOR i=1 TO 4
    IF i = 1
       MAIN.L1.HIDE
    ELSEIF i = 2
       MAIN.L2.HIDE
    ELSEIF i = 3
       MAIN.L3.HIDE
    ELSEIF i = 4
       MAIN.L4.HIDE
    ENDIF
    Main.ReDraw
    Do Events
    INKEY(1)
NEXT

RETURN
below is the simplified code

Code: Select all

*-----------
FUNCTION VEA
FOR i := 1 TO 4
    DoMethod ( "Main", "L" + StrZero ( i, 1 ), "Hide" )
    Main.ReDraw
    Do Events
    INKEY(1)
NEXT

RETURN
User avatar
LOUIS
Posts: 234
Joined: Tue Dec 11, 2012 9:05 pm
DBs Used: DBF

Re: Poco a poco

Post by LOUIS »

Dear friend Mr. Edward

You are very kind ... Thak You very much

Your help is always greatly appreciated and very helpful for me.


Regards

Louis.

P.D.- See my game in ... https://www.hmgforum.com/viewtopic.php?p=71256#p71256
Post Reply