It's possible to use Scroll (like Clipper) in a Window

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

It's possible to use Scroll (like Clipper) in a Window

Post by jparada »

Hi,

I wonder if I can use the following little code in a window.

Code: Select all

cSalida := 'Exit'
nLinea := 1
nCont  := 0

Do While .T.

  cVar := Space(6)
  @nLinea++, 0 Say 'Enter Item:' Get cVar Valid ChkItem( ) Color 'W+/N'
  Read

  If !Empty(cVar) .And. cVar # cSalida
    nCont++
      If nCont == 3
        //Reboot( )  
      Endif
  Endif
   
  If LastKey( ) == K_ESC
     ChkItem( )
  Endif

  If cVar == cSalida
    CLS
    Exit
  Endif

Enddo

Function ChkItem( )
    
   If nLinea > 24
      Scroll( 0, 0, 24, 20, 1 )
      nLinea--
   Endif

Return .T.
Any help or tip is welcome.

Thanks

Best Regards
Javier
User avatar
srvet_claudio
Posts: 2224
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: It's possible to use Scroll (like Clipper) in a Window

Post by srvet_claudio »

Hola Javier,
aqui te dejo dos programas, el primero emula el código de la rutina que posteaste y el segundo hace uso de las facilidades de HMG, espero que te sirvan de ayuda.
Saludos,
Claudio Soto.

Code: Select all

#include "minigui.ch"

FUNCTION MAIN

#define MAX_LINEA 24
PRIVATE CONTROL_LABEL := {}
PRIVATE CONT := 0  

   DEFINE WINDOW Form1;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 600 ;
      TITLE "Scroll Windows" ;
      MAIN

      @ 520, 150 BUTTON Boton1 CAPTION "New Line" ACTION NUEVA_LINEA ()   
   END WINDOW

   Form1.CENTER 
   Form1.ACTIVATE 
RETURN

PROCEDURE NUEVA_LINEA
    IF cont < MAX_LINEA
       cont ++
       Nomb_Label := "Label_"+alltrim(str(cont))
       Text := "Hola Javier.         Linea: "+str(cont)
       @ cont*20,100 LABEL &Nomb_Label OF Form1 VALUE Text AUTOSIZE   
       AADD (CONTROL_LABEL,Nomb_Label)          
    ELSE          
       FOR i = 1 TO LEN (CONTROL_LABEL)-1
           valor := GetProperty ("Form1",CONTROL_LABEL [i+1] , "VALUE")
           SetProperty ("Form1",CONTROL_LABEL [i],"VALUE", Valor)  
       NEXT
       cont++
       Text := "Hola Javier.         Linea: "+str(cont)
       SetProperty ("Form1",CONTROL_LABEL [LEN(CONTROL_LABEL)],"VALUE", text)
    ENDIF    
RETURN


Code: Select all

#include "minigui.ch"

FUNCTION MAIN
   
   DEFINE WINDOW Form1;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 400 ;
      VIRTUAL WIDTH  800;
      VIRTUAL HEIGHT 2500;
      TITLE "Scroll Windows" ;
      MAIN
     
      FOR i = 1 TO 120
          Nomb_Label := "Label_"+alltrim(str(i))
          Text := "Hola Javier.         Linea: "+str(i)
          @ i*20,100 LABEL &Nomb_Label VALUE Text AUTOSIZE
      NEXT
         
   END WINDOW

   Form1.CENTER 
   Form1.ACTIVATE 
RETURN

Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

Re: It's possible to use Scroll (like Clipper) in a Window

Post by jparada »

Hola Claudio,

Gracias,

Tus aportaciones para mi han sido de mucha ayuda.

Muchas Gracias

Saludos
Javier
User avatar
srvet_claudio
Posts: 2224
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: It's possible to use Scroll (like Clipper) in a Window

Post by srvet_claudio »

Hola Javier,
No tienes por que agradecer, es un placer poder colaborar.
Saludos,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply