Page 1 of 1

How to put scrollbar in dialog?

Posted: Fri Dec 29, 2006 5:45 pm
by Rochinha
Hello

I have tested TESTWSCR.PRG but this code uses Window.

I need use same feature with dialogs.

post a example to me,

Thanks

Re: How to put scrollbar in dialog?

Posted: Fri Dec 29, 2006 6:20 pm
by Maurilio Viana
Rochinha, my dear, I'm asking for it to Antonio a long time. I want to define dialogs with scroll into a TPage. Antonio said that must change TDialog class...
Let's wait or do for ourself. What you think?


Rochinha, meu querido, eu estou pedindo essa funcionalidade ao Antonio já há algum tempo. Pra eu poder colocar uma dialog dentro de uma TPage com scroll e ele disse que teria que alterar a classe TDialog...
Vamos aguardar ou fazer nós mesmos. O que vc acha?

Regards/Abraços
Maurilio

Posted: Sat Dec 30, 2006 12:57 am
by Rochinha
Amiguinho,

Eu também, apesar de ter feito usando Window mesmo, fica legal, mas fica fora da interface do meu aplicativo.

Quem sabe nas outras atualizações ele atenda nossos pedidos.

Mas vou dar uma analisada e quando conseguir te dou um toque.

@braços

Posted: Sat Dec 30, 2006 11:24 am
by Rossine
Olá amigos,

Eu peguei o TESTWSCR.PRG e fiz o TESTDSCR.PRG. Segue o codigo abaixo. Vejam se é isto que precisam :wink:

Code: Select all


// Testing how to scroll a dialog with its contents

#include "FiveWin.ch"

#define D_WIDTH           4
#define D_HEIGHT          13

FUNCTION Main()

LOCAL oDlg
LOCAL cGet0101 := space(10),  ; //Row 1
      cGet0102 := space(10),  ;
      cGet0103 := space(10),  ;
      cGet0104 := space(10),  ;
      cGet0105 := space(10),  ;
      cGet0201 := space(10),  ; //Row 2
      cGet0202 := space(10),  ;
      cGet0203 := space(10),  ;
      cGet0204 := space(10),  ;
      cGet0205 := space(10),  ;
      cGet0301 := space(10),  ; //Row 3
      cGet0302 := space(10),  ;
      cGet0303 := space(10),  ;
      cGet0304 := space(10),  ;
      cGet0305 := space(10),  ;
      cGet0401 := space(10),  ; //Row 4
      cGet0402 := space(10),  ;
      cGet0403 := space(10),  ;
      cGet0404 := space(10),  ;
      cGet0405 := space(10),  ;
      cGet0501 := space(10),  ; //Row 5
      cGet0502 := space(10),  ;
      cGet0503 := space(10),  ;
      cGet0504 := space(10),  ;
      cGet0505 := space(10),  ;
      cGet0601 := space(10),  ; //Row 6
      cGet0602 := space(10),  ;
      cGet0603 := space(10),  ;
      cGet0604 := space(10),  ;
      cGet0605 := space(10),  ;
      cGet0701 := space(10),  ; //Row 7
      cGet0702 := space(10),  ;
      cGet0703 := space(10),  ;
      cGet0704 := space(10),  ;
      cGet0705 := space(10),  ;
      cGet0801 := space(10),  ; //Row 8
      cGet0802 := space(10),  ;
      cGet0803 := space(10),  ;
      cGet0804 := space(10),  ;
      cGet0805 := space(10),  ;
      cGet0901 := space(10),  ; //Row 9
      cGet0902 := space(10),  ;
      cGet0903 := space(10),  ;
      cGet0904 := space(10),  ;
      cGet0905 := space(10),  ;
      cGet1001 := space(10),  ; //Row 10
      cGet1002 := space(10),  ;
      cGet1003 := space(10),  ;
      cGet1004 := space(10),  ;
      cGet1005 := space(10),  ;
      cGet1101 := space(10),  ; //Row 11
      cGet1102 := space(10),  ;
      cGet1103 := space(10),  ;
      cGet1104 := space(10),  ;
      cGet1105 := space(10)

   define dialog oDlg from 0, 0 TO 25, 70 ;
         title "Scroll dialog"            ;
         Style nor( WS_VSCROLL, WS_HSCROLL )

   @ 9,17 bitmap file "..\bitmaps\pic1.bmp" of oDlg size 120,148 adjust
   @ 9,32 bitmap file "..\bitmaps\pic2.bmp" of oDlg size 120,148 adjust
   @ 9,47 bitmap file "..\bitmaps\pic3.bmp" of oDlg size 120,148 adjust
   @ 9,62 bitmap file "..\bitmaps\pic4.bmp" of oDlg size 120,148 adjust
   @ 9,77 bitmap file "..\bitmaps\pic5.bmp" of oDlg size 120,148 adjust

   @ 21*13,02*8 say "Customer " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 23*13,02*8 say "P.O. #   " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 25*13,02*8 say "Style No." of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 27*13,02*8 say "Fabrics  " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 29*13,02*8 say "Fob      " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 31*13,02*8 say "Q'TY     " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 33*13,02*8 say "DEL.     " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 35*13,02*8 say "MAKER    " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 37*13,02*8 say "QTA      " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 39*13,02*8 say "SIZE     " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 41*13,02*8 say "Size B/D " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 43*13,02*8 say "REMARKS  " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel

   @ 21*13,17*8 say "Venture  " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,32*8 say "Sears    " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,47*8 say "Kohl's   " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,62*8 say "Kiss     " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,77*8 say "K-MART   " of oDlg update color CLR_BLACK,CLR_WHITE size 120,26 border pixel

   //-* Row 1
   @ 23*13,17*8 get cGet0101 size 120,26 of oDlg update pixel
   @ 23*13,32*8 get cGet0102 size 120,26 of oDlg update pixel
   @ 23*13,47*8 get cGet0103 size 120,26 of oDlg update pixel
   @ 23*13,62*8 get cGet0104 size 120,26 of oDlg update pixel
   @ 23*13,77*8 get cGet0105 size 120,26 of oDlg update pixel

   //-* Row 2
   @ 25*13,17*8 get cGet0201 size 120,26 of oDlg update pixel
   @ 25*13,32*8 get cGet0202 size 120,26 of oDlg update pixel
   @ 25*13,47*8 get cGet0203 size 120,26 of oDlg update pixel
   @ 25*13,62*8 get cGet0204 size 120,26 of oDlg update pixel
   @ 25*13,77*8 get cGet0205 size 120,26 of oDlg update pixel

   //-* Row 3
   @ 27*13,17*8 get cGet0301 size 120,26 of oDlg update pixel
   @ 27*13,32*8 get cGet0302 size 120,26 of oDlg update pixel
   @ 27*13,47*8 get cGet0303 size 120,26 of oDlg update pixel
   @ 27*13,62*8 get cGet0304 size 120,26 of oDlg update pixel
   @ 27*13,77*8 get cGet0305 size 120,26 of oDlg update pixel

   //-* Row 4
   @ 29*13,17*8 get cGet0401 size 120,26 of oDlg update pixel
   @ 29*13,32*8 get cGet0402 size 120,26 of oDlg update pixel
   @ 29*13,47*8 get cGet0403 size 120,26 of oDlg update pixel
   @ 29*13,62*8 get cGet0404 size 120,26 of oDlg update pixel
   @ 29*13,77*8 get cGet0405 size 120,26 of oDlg update pixel

   //-* Row 5
   @ 31*13,17*8 get cGet0501 size 120,26 of oDlg update pixel
   @ 31*13,32*8 get cGet0502 size 120,26 of oDlg update pixel
   @ 31*13,47*8 get cGet0503 size 120,26 of oDlg update pixel
   @ 31*13,62*8 get cGet0504 size 120,26 of oDlg update pixel
   @ 31*13,77*8 get cGet0505 size 120,26 of oDlg update pixel

   //-* Row 6
   @ 33*13,17*8 get cGet0601 size 120,26 of oDlg update pixel
   @ 33*13,32*8 get cGet0602 size 120,26 of oDlg update pixel
   @ 33*13,47*8 get cGet0603 size 120,26 of oDlg update pixel
   @ 33*13,62*8 get cGet0604 size 120,26 of oDlg update pixel
   @ 33*13,77*8 get cGet0605 size 120,26 of oDlg update pixel

   //-* Row 7
   @ 35*13,17*8 get cGet0701 size 120,26 of oDlg update pixel
   @ 35*13,32*8 get cGet0702 size 120,26 of oDlg update pixel
   @ 35*13,47*8 get cGet0703 size 120,26 of oDlg update pixel
   @ 35*13,62*8 get cGet0704 size 120,26 of oDlg update pixel
   @ 35*13,77*8 get cGet0705 size 120,26 of oDlg update pixel

   //-* Row 8
   @ 37*13,17*8 get cGet0801 size 120,26 of oDlg update pixel
   @ 37*13,32*8 get cGet0802 size 120,26 of oDlg update pixel
   @ 37*13,47*8 get cGet0803 size 120,26 of oDlg update pixel
   @ 37*13,62*8 get cGet0804 size 120,26 of oDlg update pixel
   @ 37*13,77*8 get cGet0805 size 120,26 of oDlg update pixel

   //-* Row 9
   @ 39*13,17*8 get cGet0901 size 120,26 of oDlg update pixel
   @ 39*13,32*8 get cGet0902 size 120,26 of oDlg update pixel
   @ 39*13,47*8 get cGet0903 size 120,26 of oDlg update pixel
   @ 39*13,62*8 get cGet0904 size 120,26 of oDlg update pixel
   @ 39*13,77*8 get cGet0905 size 120,26 of oDlg update pixel

   //-* Row 10
   @ 41*13,17*8 get cGet1001 size 120,26 of oDlg update pixel
   @ 41*13,32*8 get cGet1002 size 120,26 of oDlg update pixel
   @ 41*13,47*8 get cGet1003 size 120,26 of oDlg update pixel
   @ 41*13,62*8 get cGet1004 size 120,26 of oDlg update pixel
   @ 41*13,77*8 get cGet1005 size 120,26 of oDlg update pixel

   //-* Row 11
   @ 43*13,17*8 get cGet1101 size 120,26 of oDlg update pixel
   @ 43*13,32*8 get cGet1102 size 120,26 of oDlg update pixel
   @ 43*13,47*8 get cGet1103 size 120,26 of oDlg update pixel
   @ 43*13,62*8 get cGet1104 size 120,26 of oDlg update pixel
   @ 43*13,77*8 get cGet1105 size 120,26 of oDlg update pixel


   @ 50,20 button "&Ok" size 80,20 of oDlg   ;
      action (MsgInfo("You click OK button!"),oDlg:End())
   @ 50,40 button "&Cancel" size 80,20 of oDlg  ;
      action (MsgInfo("You click Cancel button!"),oDlg:End())

   ACTIVATE dialog oDlg    ;
      ON INIT ( TScrDlg():New(oDlg,1,40,1,70) )

RETURN( NIL )

//============================================================================
// FileName : SCROLL.PRG
// Purpose  :  dialog Scroll Class
// Author   : Eric Yang
// Update History :
//      Date     Contents
//    ---------- ---------------------------------------------------------------
//    1997.02.01
//
//============================================================================
#include "FiveWin.ch"

#ifndef TRUE
   #define TRUE              .T.
   #define FALSE             .F.
#endif

CLASS TScrDlg

   DATA oDlg
   DATA nVPos,nHPos

   METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CONSTRUCTOR
   METHOD SetScroll( nV1,nV2,nH1,nH2 )
   //-*------------------------------------------------------------
   METHOD VScroll()
   METHOD VScrollThumb()
   METHOD VScrollTrack()
   METHOD VScrollPgDown()
   METHOD VScrollPgUp()
   //-*-----------------------------
   METHOD HScroll()
   METHOD HScrollThumb()
   METHOD HScrollTrack()
   METHOD HScrollPgDown()
   METHOD HScrollPgUp()

ENDCLASS

METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CLASS TScrDlg
   ::nVPos := 0
   ::nHPos := 0
   ::oDlg := oDlg
   ::SetScroll( nV1,nV2,nH1,nH2 )
RETURN Self


METHOD SetScroll( nV1,nV2,nH1,nH2 ) CLASS TScrDlg
LOCAL aCoors1:={},aCoors2:={}
   //--------------------------------------------------
   //-* Vertical Scroll Bar
//   ? ::oDlg:oVSCroll=NIL
   if ::oDlg:oVScroll != NIL
//    ? nV1,nV2
      ::oDlg:oVScroll:SetRange( nV1,nV2 )
      ::nVPos := ::oDlg:oVScroll:GetPos()
      ::oDlg:oVScroll:bGoDown   := {|| ::VScroll() }
      ::oDlg:oVScroll:bGoUp     := {|| ::VScroll() }
      ::oDlg:oVScroll:bPageUp   := {|| ::VScrollPgUp() }
      ::oDlg:oVScroll:bPageDown := {|| ::VScrollPgDown() }
      ::oDlg:oVScroll:bGoTop    := {|| ::VScroll() }
      ::oDlg:oVScroll:bGoBottom := {|| ::VScroll() }
      ::oDlg:oVScroll:nPgStep   := 10
      //::oDlg:oVScroll:lReDraw := TRUE
      ::oDlg:oVScroll:bPos      := {|nPos| ::VScrollThumb(nPos) }
      ::oDlg:oVScroll:bTrack    := {|nPos| ::VScrollTrack(nPos) }
   endif
   //--------------------------------------------------
   //-* Horizontal Scroll Bar
   if ::oDlg:oHScroll != NIL
      ::oDlg:oHScroll:SetRange( nH1,nH2 )
      ::nHPos := ::oDlg:oHScroll:GetPos()
      ::oDlg:oHScroll:bGoDown   := {|| ::HScroll() }
      ::oDlg:oHScroll:bGoUp     := {|| ::HScroll() }
      ::oDlg:oHScroll:bPageUp   := {|| ::HScrollPgUp() }
      ::oDlg:oHScroll:bPageDown := {|| ::HScrollPgDown() }
      ::oDlg:oHScroll:bGoTop    := {|| ::HScroll() }
      ::oDlg:oHScroll:bGoBottom := {|| ::HScroll() }
      ::oDlg:oHScroll:nPgStep   := 10
      //::oDlg:oHScroll:lReDraw := TRUE
      ::oDlg:oHScroll:bPos      := {|nPos| ::HScrollThumb(nPos) }
      ::oDlg:oHScroll:bTrack    := {|nPos| ::HScrollTrack(nPos) }
   endif
   //::oDlg:bKeyChar := {|nKey,nFlags| ScrollKey(nKey) }
   //--------------------------------------------------
RETURN( NIL )

//STATIC FUNCTION ScrollKey(nKey)
   //MsgInfo( "Key : "+str(nKey,10) )
   //if nKey == K_ENTER
   //   goMainDlg:End()
   //   lRetVal := TRUE
   //endif
//RETURN( NIL )

//=================================================================
//-* Vertical Scroll Bar
METHOD VScroll() CLASS TScrDlg
LOCAL nNewPos
   if ::nVPos >= ::oDlg:oVScroll:nMin   ;
      .and. ::nVPos <= ::oDlg:oVScroll:nMax
      nNewPos := ::oDlg:oVScroll:GetPos()
      SysRefresh()

      ScrollWindow( ::oDlg:hWnd, 0,  ;
         (  ::nVPos-nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollThumb(nNewPos) CLASS TScrDlg
   if ::nVPos >= ::oDlg:oVScroll:nMin   ;
      .and. ::nVPos <= ::oDlg:oVScroll:nMax
      ::oDlg:oVScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd, 0,  ;
         (::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollTrack(nNewPos) CLASS TScrDlg
   if ::nVPos >= ::oDlg:oVScroll:nMin   ;
      .and. ::nVPos <= ::oDlg:oVScroll:nMax
      ::oDlg:oVScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd, 0,  ;
         (::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollPgDown() CLASS TScrDlg
LOCAL nNewPos
   if ::nVPos < ::oDlg:oVScroll:nMax
      nNewPos := ::nVPos + ::oDlg:oVScroll:nPgStep
      nNewPos := iif(nNewPos > ::oDlg:oVScroll:nMax, ::oDlg:oVScroll:nMax, nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd, 0,  ;
         ( ::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollPgUp() CLASS TScrDlg
LOCAL nNewPos
   if ::nVPos > ::oDlg:oVScroll:nMin
      nNewPos := ::nVPos - ::oDlg:oVScroll:nPgStep
      nNewPos := iif(nNewPos < ::oDlg:oVScroll:nMin,::oDlg:oVScroll:nMin,nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd, 0,  ;
         ( ::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

//=================================================================
//-* Horizontal Scroll Bar
METHOD HScroll() CLASS TScrDlg
LOCAL nNewPos
   if ::nHPos >= ::oDlg:oHScroll:nMin   ;
      .and. ::nHPos <= ::oDlg:oHScroll:nMax
      nNewPos := ::oDlg:oHScroll:GetPos()
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollThumb(nNewPos) CLASS TScrDlg
   if ::nHPos >= ::oDlg:oHScroll:nMin   ;
      .and. ::nHPos <= ::oDlg:oHScroll:nMax
      ::oDlg:oHScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollTrack(nNewPos) CLASS TScrDlg
   if ::nHPos >= ::oDlg:oHScroll:nMin   ;
      .and. ::nHPos <= ::oDlg:oHScroll:nMax
      ::oDlg:oHScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollPgDown() CLASS TScrDlg
LOCAL nNewPos
   if ::nHPos < ::oDlg:oHScroll:nMax
      nNewPos := ::nHPos + ::oDlg:oHScroll:nPgStep
      nNewPos := iif(nNewPos > ::oDlg:oHScroll:nMax, ::oDlg:oHScroll:nMax, nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd,           ;
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollPgUp() CLASS TScrDlg
LOCAL nNewPos
   if ::nHPos > ::oDlg:oHScroll:nMin
      nNewPos := ::nHPos - ::oDlg:oHScroll:nPgStep
      nNewPos := iif(nNewPos < ::oDlg:oHScroll:nMin,::oDlg:oHScroll:nMin,nNewPos)
      SysRefresh()
      ScrollWindow( ::oDlg:hWnd,           ;
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ;
         0 , GetClientRect(::oDlg:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

//=* End of File =================================================

procedure AppSys   // Xbase++ requirement

return

Abraços,

Rossine.

Posted: Sat Dec 30, 2006 11:54 am
by Rochinha
Amiguinhos

Rossini e Maurilio:

Creio que chegamos perto do que desejamos sim.

Cabeças pensantes quando se juntam não importando a distancia trazem bons resultados e o resultado deste post nos da a seguinte caracteristica:

Meu código de exemplo:

O primordial é definir a DIALOGo com STYLE nor( WS_VSCROLL, WS_HSCROLL )(obrigado Rossini) e modificar o tamanho da mesma através de oDlg:SetSize( ..., ... ).

Salve como TestDScr.PRG.

Code: Select all

#include "FiveWin.ch" 

#define D_WIDTH           4 
#define D_HEIGHT          13 

FUNCTION Main() 
   LOCAL oDlg 
   DEFINE DIALOG oDlg RESOURCE "dlgComScroll" ;  
         TITLE "Scroll dialog"            ; 
         STYLE nor( WS_VSCROLL, WS_HSCROLL ) 

   ACTIVATE DIALOG oDlg ; 
      ON INIT ( TScrDlg():New(oDlg,1,65,1,70), oDlg:SetSize( 560, 550 ) ) 
RETURN( NIL ) 

#include "TScrollD.prg"
Minha tela de dialogo:

O pulo-do-gato esta en acrescentar a propriedade WS_VSCROLL.

Salve como TestDScr.RC.

Code: Select all

dlgComScroll DIALOG 50, 23, 365, 812
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_VSCROLL | WS_SYSMENU
CAPTION "Ficha Cadastral"
FONT 7, "MS Sans Serif"
{
 LTEXT "Dados Pessoais", -1, 4, 4, 348, 165, WS_BORDER | WS_GROUP
 LTEXT "Dados do Conjuge", -1, 4, 171, 348, 89, WS_BORDER | WS_GROUP
 LTEXT "Dados do Avalista", -1, 4, 263, 348, 113, WS_BORDER | WS_GROUP
 LTEXT "Dados Profissionais do Financiado", 247, 4, 379, 348, 164, WS_BORDER | WS_GROUP
 LTEXT "Referencias Pessoais e Bancarias", -1, 4, 546, 348, 87, WS_BORDER | WS_GROUP
 LTEXT "Dados da Operação", 282, 4, 702, 348, 89, WS_BORDER | WS_GROUP
 LTEXT "Veiculo", -1, 4, 635, 348, 64, WS_BORDER | WS_GROUP
 CONTROL "101", 101, "EDIT", WS_BORDER | WS_TABSTOP, 10, 23, 196, 12
 CONTROL "102", 102, "EDIT", WS_BORDER | WS_TABSTOP, 210, 23, 66, 12
 CONTROL "103", 103, "EDIT", WS_BORDER | WS_TABSTOP, 280, 23, 66, 12
 CONTROL "104", 104, "EDIT", WS_BORDER | WS_TABSTOP, 10, 49, 66, 12
 CONTROL "105", 105, "EDIT", WS_BORDER | WS_TABSTOP, 81, 49, 66, 12
 CONTROL "106", 106, "EDIT", WS_BORDER | WS_TABSTOP, 151, 49, 56, 12
 CONTROL "107", 107, "EDIT", WS_BORDER | WS_TABSTOP, 210, 49, 66, 12
 CHECKBOX "Fem", 108, 282, 48, 30, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Mas", 109, 315, 48, 30, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "110", 110, "EDIT", WS_BORDER | WS_TABSTOP, 11, 75, 66, 12
 CONTROL "111", 111, "EDIT", WS_BORDER | WS_TABSTOP, 81, 75, 126, 12
 CONTROL "112", 112, "EDIT", WS_BORDER | WS_TABSTOP, 210, 75, 136, 12
 CONTROL "113", 113, "EDIT", WS_BORDER | WS_TABSTOP, 11, 100, 241, 12
 CONTROL "114", 114, "EDIT", WS_BORDER | WS_TABSTOP, 254, 100, 92, 12
 CONTROL "115", 115, "EDIT", WS_BORDER | WS_TABSTOP, 11, 126, 184, 12
 CONTROL "116", 116, "EDIT", WS_BORDER | WS_TABSTOP, 197, 126, 55, 12
 CONTROL "117", 117, "EDIT", WS_BORDER | WS_TABSTOP, 254, 126, 92, 12
 CONTROL "118", 118, "EDIT", WS_BORDER | WS_TABSTOP, 11, 151, 111, 12
 CONTROL "119", 119, "EDIT", WS_BORDER | WS_TABSTOP, 125, 151, 113, 12
 CONTROL "120", 120, "EDIT", WS_BORDER | WS_TABSTOP, 241, 151, 66, 12
 CHECKBOX "Propria", 121, 309, 141, 39, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Alugada", 122, 309, 152, 40, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "123", 123, "EDIT", WS_BORDER | WS_TABSTOP, 11, 192, 194, 12
 CONTROL "124", 124, "EDIT", WS_BORDER | WS_TABSTOP, 208, 192, 138, 12
 CONTROL "125", 125, "EDIT", WS_BORDER | WS_TABSTOP, 11, 217, 131, 12
 CONTROL "126", 126, "EDIT", WS_BORDER | WS_TABSTOP, 145, 217, 101, 12
 CONTROL "127", 127, "EDIT", WS_BORDER | WS_TABSTOP, 249, 217, 97, 12
 CONTROL "128", 128, "EDIT", WS_BORDER | WS_TABSTOP, 11, 242, 184, 12
 CONTROL "129", 129, "EDIT", WS_BORDER | WS_TABSTOP, 197, 242, 55, 12
 CONTROL "130", 130, "EDIT", WS_BORDER | WS_TABSTOP, 254, 242, 92, 12
 CONTROL "131", 131, "EDIT", WS_BORDER | WS_TABSTOP, 10, 282, 197, 12
 CONTROL "132", 132, "EDIT", WS_BORDER | WS_TABSTOP, 210, 282, 66, 12
 CONTROL "133", 133, "EDIT", WS_BORDER | WS_TABSTOP, 280, 282, 66, 12
 CONTROL "134", 134, "EDIT", WS_BORDER | WS_TABSTOP, 11, 307, 173, 12
 CONTROL "135", 135, "EDIT", WS_BORDER | WS_TABSTOP, 187, 307, 65, 12
 CONTROL "136", 136, "EDIT", WS_BORDER | WS_TABSTOP, 254, 307, 92, 12
 CONTROL "137", 137, "EDIT", WS_BORDER | WS_TABSTOP, 11, 332, 134, 12
 CONTROL "138", 138, "EDIT", WS_BORDER | WS_TABSTOP, 148, 332, 36, 12
 CONTROL "139", 139, "EDIT", WS_BORDER | WS_TABSTOP, 187, 332, 65, 12
 CONTROL "140", 140, "EDIT", WS_BORDER | WS_TABSTOP, 254, 332, 92, 12
 CONTROL "141", 141, "EDIT", WS_BORDER | WS_TABSTOP, 11, 358, 184, 12
 CONTROL "142", 142, "EDIT", WS_BORDER | WS_TABSTOP, 197, 358, 55, 12
 CONTROL "143", 143, "EDIT", WS_BORDER | WS_TABSTOP, 254, 358, 92, 12
 CONTROL "144", 144, "EDIT", WS_BORDER | WS_TABSTOP, 11, 400, 194, 12
 CONTROL "145", 145, "EDIT", WS_BORDER | WS_TABSTOP, 208, 400, 138, 12
 CONTROL "146", 146, "EDIT", WS_BORDER | WS_TABSTOP, 11, 425, 112, 12
 CONTROL "147", 147, "EDIT", WS_BORDER | WS_TABSTOP, 125, 425, 59, 12
 CONTROL "148", 148, "EDIT", WS_BORDER | WS_TABSTOP, 187, 425, 65, 12
 CONTROL "149", 149, "EDIT", WS_BORDER | WS_TABSTOP, 254, 425, 92, 12
 CONTROL "150", 150, "EDIT", WS_BORDER | WS_TABSTOP, 11, 450, 241, 12
 CONTROL "151", 151, "EDIT", WS_BORDER | WS_TABSTOP, 254, 450, 92, 12
 CONTROL "152", 152, "EDIT", WS_BORDER | WS_TABSTOP, 11, 475, 184, 12
 CONTROL "153", 153, "EDIT", WS_BORDER | WS_TABSTOP, 197, 475, 55, 12
 CONTROL "154", 154, "EDIT", WS_BORDER | WS_TABSTOP, 254, 475, 92, 12
 CONTROL "155", 155, "EDIT", WS_BORDER | WS_TABSTOP, 11, 500, 194, 12
 CONTROL "156", 156, "EDIT", WS_BORDER | WS_TABSTOP, 208, 500, 138, 12
 CONTROL "157", 157, "EDIT", WS_BORDER | WS_TABSTOP, 11, 525, 111, 12
 CONTROL "158", 158, "EDIT", WS_BORDER | WS_TABSTOP, 125, 525, 113, 12
 CHECKBOX "Residencial", 159, 289, 515, 54, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Comercial", 160, 289, 526, 51, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "161", 161, "EDIT", WS_BORDER | WS_TABSTOP, 10, 565, 197, 12
 CONTROL "162", 162, "EDIT", WS_BORDER | WS_TABSTOP, 210, 565, 66, 12
 CONTROL "163", 163, "EDIT", WS_BORDER | WS_TABSTOP, 280, 565, 66, 12
 CONTROL "164", 164, "EDIT", WS_BORDER | WS_TABSTOP, 10, 590, 241, 12
 CONTROL "165", 165, "EDIT", WS_BORDER | WS_TABSTOP, 253, 590, 93, 12
 CONTROL "166", 166, "EDIT", WS_BORDER | WS_TABSTOP, 11, 615, 112, 12
 CONTROL "167", 167, "EDIT", WS_BORDER | WS_TABSTOP, 125, 615, 59, 12
 CONTROL "168", 168, "EDIT", WS_BORDER | WS_TABSTOP, 187, 615, 65, 12
 CONTROL "169", 169, "EDIT", WS_BORDER | WS_TABSTOP, 254, 615, 92, 12
 CONTROL "170", 170, "EDIT", WS_BORDER | WS_TABSTOP, 10, 655, 96, 12
 CONTROL "171", 171, "EDIT", WS_BORDER | WS_TABSTOP, 109, 655, 39, 12
 CONTROL "172", 172, "EDIT", WS_BORDER | WS_TABSTOP, 151, 655, 56, 12
 CONTROL "173", 173, "EDIT", WS_BORDER | WS_TABSTOP, 210, 655, 66, 12
 CONTROL "174", 174, "EDIT", WS_BORDER | WS_TABSTOP, 279, 655, 68, 12
 CONTROL "175", 175, "EDIT", WS_BORDER | WS_TABSTOP, 11, 681, 184, 12
 CONTROL "176", 176, "EDIT", WS_BORDER | WS_TABSTOP, 197, 681, 55, 12
 CONTROL "177", 177, "EDIT", WS_BORDER | WS_TABSTOP, 254, 681, 92, 12
 CONTROL "178", 178, "EDIT", WS_BORDER | WS_TABSTOP, 11, 723, 131, 12
 CONTROL "179", 179, "EDIT", WS_BORDER | WS_TABSTOP, 145, 723, 101, 12
 CONTROL "180", 180, "EDIT", WS_BORDER | WS_TABSTOP, 249, 723, 97, 12
 CONTROL "181", 181, "EDIT", WS_BORDER | WS_TABSTOP, 10, 748, 78, 12
 CONTROL "182", 182, "EDIT", WS_BORDER | WS_TABSTOP, 90, 748, 53, 12
 CONTROL "183", 183, "EDIT", WS_BORDER | WS_TABSTOP, 145, 748, 63, 12
 CONTROL "184", 184, "EDIT", WS_BORDER | WS_TABSTOP, 210, 748, 66, 12
 CONTROL "185", 185, "EDIT", WS_BORDER | WS_TABSTOP, 279, 748, 68, 12
 CONTROL "186", 186, "EDIT", WS_BORDER | WS_TABSTOP, 10, 773, 158, 12
 CONTROL "187", 187, "EDIT", WS_BORDER | WS_TABSTOP, 170, 773, 176, 12
 LTEXT "Nome", -1, 9, 13, 197, 10
 LTEXT "Data Nasc.", -1, 209, 13, 68, 9
 LTEXT "Estado Civil", -1, 279, 13, 68, 10
 LTEXT "CPF", -1, 9, 39, 68, 9
 LTEXT "RG", -1, 80, 39, 68, 10
 LTEXT "Orgao Expeditor", -1, 150, 39, 56, 9
 LTEXT "Emissão", -1, 209, 39, 68, 10
 LTEXT "_", -1, 279, 39, 68, 10
 LTEXT "Naturalidade", -1, 10, 65, 45, 10
 LTEXT "Pai", -1, 80, 65, 32, 10
 LTEXT "Mae", -1, 209, 65, 32, 10
 LTEXT "Endereco Residencial", -1, 10, 90, 78, 9
 LTEXT "Bairro", -1, 253, 90, 32, 10
 LTEXT "Cidade", -1, 10, 116, 32, 9
 LTEXT "UF", -1, 196, 116, 32, 10
 LTEXT "CEP", -1, 253, 116, 32, 10
 LTEXT "Telefone", -1, 10, 141, 32, 10
 LTEXT "Celular", -1, 124, 141, 32, 10
 LTEXT "Tempo Resid.", -1, 240, 141, 49, 10
 LTEXT "Nome", -1, 10, 182, 32, 10
 LTEXT "CPF", -1, 207, 182, 32, 10
 LTEXT "RG", -1, 10, 207, 32, 10
 LTEXT "Emissao", -1, 144, 207, 32, 10
 LTEXT "Data Nasc.", -1, 248, 207, 57, 10
 LTEXT "Empresa onde trabalha", -1, 10, 232, 32, 9
 LTEXT "Telefone", -1, 196, 232, 32, 10
 LTEXT "Salario", -1, 253, 232, 32, 10
 LTEXT "Nome", -1, 9, 272, 197, 10
 LTEXT "Data Nasc.", -1, 209, 272, 68, 9
 LTEXT "CPF", -1, 279, 272, 68, 10
 LTEXT "Endereco", -1, 10, 297, 32, 9
 LTEXT "Bairro", -1, 186, 297, 32, 10
 LTEXT "Telefone", -1, 253, 297, 32, 10
 LTEXT "Cidade", -1, 10, 322, 32, 9
 LTEXT "CEP", -1, 186, 322, 32, 10
 LTEXT "RG", -1, 253, 322, 32, 10
 LTEXT "UF", -1, 147, 322, 32, 10
 LTEXT "Empresa onde trabalha", -1, 10, 348, 32, 9
 LTEXT "Telefone", -1, 196, 348, 32, 10
 LTEXT "Renda avalista", -1, 253, 348, 55, 10
 LTEXT "Empresa onde trabalha", -1, 10, 390, 32, 10
 LTEXT "CNPJ", -1, 207, 390, 32, 10
 LTEXT "Cargo", -1, 10, 415, 32, 9
 LTEXT "Renda", -1, 186, 415, 32, 10
 LTEXT "Telefone", -1, 253, 415, 32, 10
 LTEXT "Admissão", -1, 124, 415, 32, 10
 LTEXT "Endereco ", -1, 10, 440, 78, 9
 LTEXT "Bairro", -1, 253, 440, 32, 10
 LTEXT "Cidade", -1, 10, 465, 32, 9
 LTEXT "UF", -1, 196, 465, 32, 10
 LTEXT "CEP", -1, 253, 465, 32, 10
 LTEXT "Empresa Anterior", -1, 10, 490, 71, 10
 LTEXT "CNPJ", -1, 207, 490, 32, 10
 LTEXT "Telefone", -1, 10, 515, 32, 10
 LTEXT "Celular", -1, 124, 515, 32, 10
 LTEXT "End.Cobrança", -1, 240, 515, 49, 10
 LTEXT "Banco", -1, 9, 555, 197, 10
 LTEXT "Agencia", -1, 209, 555, 68, 9
 LTEXT "Conta Corrente", -1, 279, 555, 68, 10
 LTEXT "Endereco ", -1, 9, 580, 78, 9
 LTEXT "Telefone", -1, 252, 580, 32, 10
 LTEXT "Nome(Pessoais)", -1, 10, 605, 64, 9
 LTEXT "Comercial/Pessoal", -1, 186, 605, 66, 10
 LTEXT "Telefone", -1, 253, 605, 32, 10
 LTEXT "Telefone", -1, 124, 605, 32, 10
 LTEXT "Marca", -1, 9, 645, 68, 9
 LTEXT "Ano", -1, 109, 645, 24, 10
 LTEXT "Modelo", -1, 150, 645, 56, 9
 LTEXT "Placa", -1, 209, 645, 68, 10
 LTEXT "Renavam", -1, 279, 645, 68, 10
 LTEXT "Chassi", -1, 10, 671, 32, 9
 LTEXT "Cor", -1, 196, 671, 32, 10
 LTEXT "Combustivel", -1, 253, 671, 48, 10
 LTEXT "Valor", -1, 10, 713, 32, 10
 LTEXT "Entrada", -1, 144, 713, 32, 10
 LTEXT "Valor do Credito Financiado", -1, 248, 713, 96, 10
 LTEXT "Valor da TAC", -1, 9, 738, 68, 9
 LTEXT "Tabela", -1, 90, 738, 24, 10
 LTEXT "Coeficiente", -1, 144, 738, 56, 9
 LTEXT "Prazo", -1, 209, 738, 68, 10
 LTEXT "Carencia", -1, 279, 738, 68, 10
 LTEXT "Valor da Parcela", -1, 9, 763, 71, 10
 LTEXT "Primeiro Vencimento", -1, 169, 763, 73, 10
 PUSHBUTTON "Confirma Operação", 88, 192, 794, 76, 14
 PUSHBUTTON "Cancela Operação", 89, 270, 794, 82, 14
}
Codigo completo da TScrollD.PRG

Code: Select all

//============================================================================ 
// FileName : SCROLL.PRG 
// Purpose  :  dialog Scroll Class 
// Author   : Eric Yang 
// Update History : 
//      Date     Contents 
//    ---------- --------------------------------------------------------------- 
//    1997.02.01 
//    2006.29.12 By Rossini - Brasil 
//============================================================================ 
#include "FiveWin.ch" 

#ifndef TRUE 
   #define TRUE              .T. 
   #define FALSE             .F. 
#endif 

CLASS TScrDlg 

   DATA oDlg 
   DATA nVPos,nHPos 

   METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CONSTRUCTOR 
   METHOD SetScroll( nV1,nV2,nH1,nH2 ) 
   //-*------------------------------------------------------------ 
   METHOD VScroll() 
   METHOD VScrollThumb() 
   METHOD VScrollTrack() 
   METHOD VScrollPgDown() 
   METHOD VScrollPgUp() 
   //-*----------------------------- 
   METHOD HScroll() 
   METHOD HScrollThumb() 
   METHOD HScrollTrack() 
   METHOD HScrollPgDown() 
   METHOD HScrollPgUp() 

ENDCLASS 

METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CLASS TScrDlg 
   ::nVPos := 0 
   ::nHPos := 0 
   ::oDlg := oDlg 
   ::SetScroll( nV1,nV2,nH1,nH2 ) 
RETURN Self 

METHOD SetScroll( nV1,nV2,nH1,nH2 ) CLASS TScrDlg 
LOCAL aCoors1:={},aCoors2:={} 
   //-------------------------------------------------- 
   //-* Vertical Scroll Bar 
//   ? ::oDlg:oVSCroll=NIL 
   if ::oDlg:oVScroll != NIL 
//    ? nV1,nV2 
      ::oDlg:oVScroll:SetRange( nV1,nV2 ) 
      ::nVPos := ::oDlg:oVScroll:GetPos() 
      ::oDlg:oVScroll:bGoDown   := {|| ::VScroll() } 
      ::oDlg:oVScroll:bGoUp     := {|| ::VScroll() } 
      ::oDlg:oVScroll:bPageUp   := {|| ::VScrollPgUp() } 
      ::oDlg:oVScroll:bPageDown := {|| ::VScrollPgDown() } 
      ::oDlg:oVScroll:bGoTop    := {|| ::VScroll() } 
      ::oDlg:oVScroll:bGoBottom := {|| ::VScroll() } 
      ::oDlg:oVScroll:nPgStep   := 10 
      //::oDlg:oVScroll:lReDraw := TRUE 
      ::oDlg:oVScroll:bPos      := {|nPos| ::VScrollThumb(nPos) } 
      ::oDlg:oVScroll:bTrack    := {|nPos| ::VScrollTrack(nPos) } 
   endif 
   //-------------------------------------------------- 
   //-* Horizontal Scroll Bar 
   if ::oDlg:oHScroll != NIL 
      ::oDlg:oHScroll:SetRange( nH1,nH2 ) 
      ::nHPos := ::oDlg:oHScroll:GetPos() 
      ::oDlg:oHScroll:bGoDown   := {|| ::HScroll() } 
      ::oDlg:oHScroll:bGoUp     := {|| ::HScroll() } 
      ::oDlg:oHScroll:bPageUp   := {|| ::HScrollPgUp() } 
      ::oDlg:oHScroll:bPageDown := {|| ::HScrollPgDown() } 
      ::oDlg:oHScroll:bGoTop    := {|| ::HScroll() } 
      ::oDlg:oHScroll:bGoBottom := {|| ::HScroll() } 
      ::oDlg:oHScroll:nPgStep   := 10 
      //::oDlg:oHScroll:lReDraw := TRUE 
      ::oDlg:oHScroll:bPos      := {|nPos| ::HScrollThumb(nPos) } 
      ::oDlg:oHScroll:bTrack    := {|nPos| ::HScrollTrack(nPos) } 
   endif 
   //::oDlg:bKeyChar := {|nKey,nFlags| ScrollKey(nKey) } 
   //-------------------------------------------------- 
RETURN( NIL ) 

//STATIC FUNCTION ScrollKey(nKey) 
   //MsgInfo( "Key : "+str(nKey,10) ) 
   //if nKey == K_ENTER 
   //   goMainDlg:End() 
   //   lRetVal := TRUE 
   //endif 
//RETURN( NIL ) 

//================================================================= 
//-* Vertical Scroll Bar 
METHOD VScroll() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nVPos >= ::oDlg:oVScroll:nMin   ; 
      .and. ::nVPos <= ::oDlg:oVScroll:nMax 
      nNewPos := ::oDlg:oVScroll:GetPos() 
      SysRefresh() 

      ScrollWindow( ::oDlg:hWnd, 0,  ; 
         (  ::nVPos-nNewPos )*D_HEIGHT,    ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nVPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD VScrollThumb(nNewPos) CLASS TScrDlg 
   if ::nVPos >= ::oDlg:oVScroll:nMin   ; 
      .and. ::nVPos <= ::oDlg:oVScroll:nMax 
      ::oDlg:oVScroll:SetPos(nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd, 0,  ; 
         (::nVPos - nNewPos )*D_HEIGHT,    ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nVPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD VScrollTrack(nNewPos) CLASS TScrDlg 
   if ::nVPos >= ::oDlg:oVScroll:nMin   ; 
      .and. ::nVPos <= ::oDlg:oVScroll:nMax 
      ::oDlg:oVScroll:SetPos(nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd, 0,  ; 
         (::nVPos - nNewPos )*D_HEIGHT,    ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nVPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD VScrollPgDown() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nVPos < ::oDlg:oVScroll:nMax 
      nNewPos := ::nVPos + ::oDlg:oVScroll:nPgStep 
      nNewPos := iif(nNewPos > ::oDlg:oVScroll:nMax, ::oDlg:oVScroll:nMax, nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd, 0,  ; 
         ( ::nVPos - nNewPos )*D_HEIGHT,    ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nVPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD VScrollPgUp() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nVPos > ::oDlg:oVScroll:nMin 
      nNewPos := ::nVPos - ::oDlg:oVScroll:nPgStep 
      nNewPos := iif(nNewPos < ::oDlg:oVScroll:nMin,::oDlg:oVScroll:nMin,nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd, 0,  ; 
         ( ::nVPos - nNewPos )*D_HEIGHT,    ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nVPos := nNewPos 
   endif 
RETURN( NIL ) 

//================================================================= 
//-* Horizontal Scroll Bar 
METHOD HScroll() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nHPos >= ::oDlg:oHScroll:nMin   ; 
      .and. ::nHPos <= ::oDlg:oHScroll:nMax 
      nNewPos := ::oDlg:oHScroll:GetPos() 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd,           ; 
         (::nHPos - nNewPos )*D_WIDTH,0,   ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nHPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD HScrollThumb(nNewPos) CLASS TScrDlg 
   if ::nHPos >= ::oDlg:oHScroll:nMin   ; 
      .and. ::nHPos <= ::oDlg:oHScroll:nMax 
      ::oDlg:oHScroll:SetPos(nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd,           ; 
         (::nHPos - nNewPos )*D_WIDTH,0,   ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nHPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD HScrollTrack(nNewPos) CLASS TScrDlg 
   if ::nHPos >= ::oDlg:oHScroll:nMin   ; 
      .and. ::nHPos <= ::oDlg:oHScroll:nMax 
      ::oDlg:oHScroll:SetPos(nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd,           ; 
         (::nHPos - nNewPos )*D_WIDTH,0,   ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nHPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD HScrollPgDown() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nHPos < ::oDlg:oHScroll:nMax 
      nNewPos := ::nHPos + ::oDlg:oHScroll:nPgStep 
      nNewPos := iif(nNewPos > ::oDlg:oHScroll:nMax, ::oDlg:oHScroll:nMax, nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd,           ; 
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nHPos := nNewPos 
   endif 
RETURN( NIL ) 

METHOD HScrollPgUp() CLASS TScrDlg 
LOCAL nNewPos 
   if ::nHPos > ::oDlg:oHScroll:nMin 
      nNewPos := ::nHPos - ::oDlg:oHScroll:nPgStep 
      nNewPos := iif(nNewPos < ::oDlg:oHScroll:nMin,::oDlg:oHScroll:nMin,nNewPos) 
      SysRefresh() 
      ScrollWindow( ::oDlg:hWnd,           ; 
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ; 
         0 , GetClientRect(::oDlg:hWnd) ) 
      ::nHPos := nNewPos 
   endif 
RETURN( NIL ) 

//=* End of File ================================================= 

procedure AppSys   // Xbase++ requirement 
return 
Bom com isto consegui colocar minha super dialog com scroll agora vou buscar colocar dentro de folder e pages.

Até lá...

Para Nosotros: Esta es la modificacione de la TScroll.PRG original para permitir hacer Scroll en dialogos.

@braços :?)

Posted: Sat Dec 30, 2006 5:32 pm
by Rochinha
Amiguinhos

Agora ta bom. Com este exemplo da pra colocar o scroll belezinha em nossas pages, não testei com folder mas isto fico por conta de voces.

Os codigos falarão por si mesmo. Desculpe-me pelo calculo maluco colocado na classe TPages.

Codigo do TestPage.prg:

Code: Select all

// Testing the new FiveWin TPages Class

#include "FiveWin.ch"
#include "Folder.ch"

#define COMSCROLL .T.
#define SEMSCROLL .F.

//----------------------------------------------------------------------------//

function Main()

   local oSDlg, oPags
   local lTest  := .t.
   local lTest2 := .t.

   SET _3DLOOK ON

   DEFINE DIALOG oSDlg RESOURCE "Main"

   REDEFINE PAGES oPags ID 110 OF oSDlg ;
      DIALOGS "dlgConnect", "One", "Two", "Three" 

   // The same as we do with folders
   REDEFINE CHECKBOX lTest  ID 110 OF oPags:aDialogs[ 1 ]

   REDEFINE CHECKBOX lTest2 ID 120 OF oPags:aDialogs[ 1 ]

   REDEFINE BUTTON ID 120 OF oSDlg ACTION oPags:GoPrev()

   REDEFINE BUTTON ID 130 OF oSDlg ACTION oPags:GoNext()

   /* ************ DEFINO QUAIS PAGINAS TEM SCROLL ************ */
   oPags:aScrolls := { SEMSCROLL, SEMSCROLL, SEMSCROLL, COMSCROLL }
   /* ************ DEFINO QUAIS PAGINAS TEM SCROLL ************ */

   ACTIVATE DIALOG oSDlg CENTERED

return nil

//----------------------------------------------------------------------------//

#include "TScrollD.prg"
#include "TPages.prg"
Codigo de TestPage.RC:

Code: Select all

#include "WinApi.ch"

main DIALOG 9, 21, 391, 302
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing the new TPages Class"
FONT 8, "MS Sans Serif"
{
 CONTROL "TPages", 110, "TPages", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 6, 3, 380, 272
 PUSHBUTTON "< &Voltar", 120, 238, 281, 42, 14
 PUSHBUTTON "&Avançar >", 130, 280, 281, 41, 14
 PUSHBUTTON "Cancela", 2, 337, 281, 45, 14
}

one DIALOG 29, 50, 187, 124
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
 LTEXT "This is the first page", -1, 60, 13, 67, 8
 CHECKBOX "Checkbox", 110, 37, 45, 44, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Checkbox", 120, 37, 56, 45, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Checkbox", 130, 37, 67, 60, 12, BS_AUTOCHECKBOX | WS_TABSTOP
}

two DIALOG 29, 50, 187, 124
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
 LTEXT "This is the second page", -1, 60, 13, 78, 8
 LISTBOX 110, 15, 28, 69, 68, LBS_STANDARD
 LISTBOX 120, 93, 29, 70, 72, LBS_STANDARD
}

three DIALOG 29, 50, 187, 122
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
 LTEXT "This is the third page", -1, 60, 13, 72, 8
 SCROLLBAR 110, 21, 80, 154, 9
 EDITTEXT 120, 34, 51, 57, 12
 CHECKBOX "Checkbox", 130, 104, 50, 46, 12, BS_AUTOCHECKBOX | WS_TABSTOP
}

dlgConnect DIALOG 50, 23, 365, 825
STYLE WS_CHILD | WS_VISIBLE | WS_VSCROLL
FONT 7, "MS Sans Serif"
{
 LTEXT "Dados Pessoais", -1, 4, 4, 348, 165, WS_BORDER | WS_GROUP
 LTEXT "Dados do Conjuge", -1, 4, 171, 348, 89, WS_BORDER | WS_GROUP
 LTEXT "Dados do Avalista", -1, 4, 263, 348, 113, WS_BORDER | WS_GROUP
 LTEXT "Dados Profissionais do Financiado", 247, 4, 379, 348, 164, WS_BORDER | WS_GROUP
 LTEXT "Referencias Pessoais e Bancarias", -1, 4, 546, 348, 87, WS_BORDER | WS_GROUP
 LTEXT "Dados da Operação", 282, 4, 702, 348, 89, WS_BORDER | WS_GROUP
 LTEXT "Veiculo", -1, 4, 635, 348, 64, WS_BORDER | WS_GROUP
 CONTROL "101", 101, "EDIT", WS_BORDER | WS_TABSTOP, 10, 23, 196, 12
 CONTROL "102", 102, "EDIT", WS_BORDER | WS_TABSTOP, 210, 23, 66, 12
 CONTROL "103", 103, "EDIT", WS_BORDER | WS_TABSTOP, 280, 23, 66, 12
 CONTROL "104", 104, "EDIT", WS_BORDER | WS_TABSTOP, 10, 49, 66, 12
 CONTROL "105", 105, "EDIT", WS_BORDER | WS_TABSTOP, 81, 49, 66, 12
 CONTROL "106", 106, "EDIT", WS_BORDER | WS_TABSTOP, 151, 49, 56, 12
 CONTROL "107", 107, "EDIT", WS_BORDER | WS_TABSTOP, 210, 49, 66, 12
 CHECKBOX "Fem", 108, 282, 48, 30, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Mas", 109, 315, 48, 30, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "110", 110, "EDIT", WS_BORDER | WS_TABSTOP, 11, 75, 66, 12
 CONTROL "111", 111, "EDIT", WS_BORDER | WS_TABSTOP, 81, 75, 126, 12
 CONTROL "112", 112, "EDIT", WS_BORDER | WS_TABSTOP, 210, 75, 136, 12
 CONTROL "113", 113, "EDIT", WS_BORDER | WS_TABSTOP, 11, 100, 241, 12
 CONTROL "114", 114, "EDIT", WS_BORDER | WS_TABSTOP, 254, 100, 92, 12
 CONTROL "115", 115, "EDIT", WS_BORDER | WS_TABSTOP, 11, 126, 184, 12
 CONTROL "116", 116, "EDIT", WS_BORDER | WS_TABSTOP, 197, 126, 55, 12
 CONTROL "117", 117, "EDIT", WS_BORDER | WS_TABSTOP, 254, 126, 92, 12
 CONTROL "118", 118, "EDIT", WS_BORDER | WS_TABSTOP, 11, 151, 111, 12
 CONTROL "119", 119, "EDIT", WS_BORDER | WS_TABSTOP, 125, 151, 113, 12
 CONTROL "120", 120, "EDIT", WS_BORDER | WS_TABSTOP, 241, 151, 66, 12
 CHECKBOX "Propria", 121, 309, 141, 39, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Alugada", 122, 309, 152, 40, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "123", 123, "EDIT", WS_BORDER | WS_TABSTOP, 11, 192, 194, 12
 CONTROL "124", 124, "EDIT", WS_BORDER | WS_TABSTOP, 208, 192, 138, 12
 CONTROL "125", 125, "EDIT", WS_BORDER | WS_TABSTOP, 11, 217, 131, 12
 CONTROL "126", 126, "EDIT", WS_BORDER | WS_TABSTOP, 145, 217, 101, 12
 CONTROL "127", 127, "EDIT", WS_BORDER | WS_TABSTOP, 249, 217, 97, 12
 CONTROL "128", 128, "EDIT", WS_BORDER | WS_TABSTOP, 11, 242, 184, 12
 CONTROL "129", 129, "EDIT", WS_BORDER | WS_TABSTOP, 197, 242, 55, 12
 CONTROL "130", 130, "EDIT", WS_BORDER | WS_TABSTOP, 254, 242, 92, 12
 CONTROL "131", 131, "EDIT", WS_BORDER | WS_TABSTOP, 10, 282, 197, 12
 CONTROL "132", 132, "EDIT", WS_BORDER | WS_TABSTOP, 210, 282, 66, 12
 CONTROL "133", 133, "EDIT", WS_BORDER | WS_TABSTOP, 280, 282, 66, 12
 CONTROL "134", 134, "EDIT", WS_BORDER | WS_TABSTOP, 11, 307, 173, 12
 CONTROL "135", 135, "EDIT", WS_BORDER | WS_TABSTOP, 187, 307, 65, 12
 CONTROL "136", 136, "EDIT", WS_BORDER | WS_TABSTOP, 254, 307, 92, 12
 CONTROL "137", 137, "EDIT", WS_BORDER | WS_TABSTOP, 11, 332, 134, 12
 CONTROL "138", 138, "EDIT", WS_BORDER | WS_TABSTOP, 148, 332, 36, 12
 CONTROL "139", 139, "EDIT", WS_BORDER | WS_TABSTOP, 187, 332, 65, 12
 CONTROL "140", 140, "EDIT", WS_BORDER | WS_TABSTOP, 254, 332, 92, 12
 CONTROL "141", 141, "EDIT", WS_BORDER | WS_TABSTOP, 11, 358, 184, 12
 CONTROL "142", 142, "EDIT", WS_BORDER | WS_TABSTOP, 197, 358, 55, 12
 CONTROL "143", 143, "EDIT", WS_BORDER | WS_TABSTOP, 254, 358, 92, 12
 CONTROL "144", 144, "EDIT", WS_BORDER | WS_TABSTOP, 11, 400, 194, 12
 CONTROL "145", 145, "EDIT", WS_BORDER | WS_TABSTOP, 208, 400, 138, 12
 CONTROL "146", 146, "EDIT", WS_BORDER | WS_TABSTOP, 11, 425, 112, 12
 CONTROL "147", 147, "EDIT", WS_BORDER | WS_TABSTOP, 125, 425, 59, 12
 CONTROL "148", 148, "EDIT", WS_BORDER | WS_TABSTOP, 187, 425, 65, 12
 CONTROL "149", 149, "EDIT", WS_BORDER | WS_TABSTOP, 254, 425, 92, 12
 CONTROL "150", 150, "EDIT", WS_BORDER | WS_TABSTOP, 11, 450, 241, 12
 CONTROL "151", 151, "EDIT", WS_BORDER | WS_TABSTOP, 254, 450, 92, 12
 CONTROL "152", 152, "EDIT", WS_BORDER | WS_TABSTOP, 11, 475, 184, 12
 CONTROL "153", 153, "EDIT", WS_BORDER | WS_TABSTOP, 197, 475, 55, 12
 CONTROL "154", 154, "EDIT", WS_BORDER | WS_TABSTOP, 254, 475, 92, 12
 CONTROL "155", 155, "EDIT", WS_BORDER | WS_TABSTOP, 11, 500, 194, 12
 CONTROL "156", 156, "EDIT", WS_BORDER | WS_TABSTOP, 208, 500, 138, 12
 CONTROL "157", 157, "EDIT", WS_BORDER | WS_TABSTOP, 11, 525, 111, 12
 CONTROL "158", 158, "EDIT", WS_BORDER | WS_TABSTOP, 125, 525, 113, 12
 CHECKBOX "Residencial", 159, 289, 515, 54, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CHECKBOX "Comercial", 160, 289, 526, 51, 12, BS_AUTOCHECKBOX | WS_TABSTOP
 CONTROL "161", 161, "EDIT", WS_BORDER | WS_TABSTOP, 10, 565, 197, 12
 CONTROL "162", 162, "EDIT", WS_BORDER | WS_TABSTOP, 210, 565, 66, 12
 CONTROL "163", 163, "EDIT", WS_BORDER | WS_TABSTOP, 280, 565, 66, 12
 CONTROL "164", 164, "EDIT", WS_BORDER | WS_TABSTOP, 10, 590, 241, 12
 CONTROL "165", 165, "EDIT", WS_BORDER | WS_TABSTOP, 253, 590, 93, 12
 CONTROL "166", 166, "EDIT", WS_BORDER | WS_TABSTOP, 11, 615, 112, 12
 CONTROL "167", 167, "EDIT", WS_BORDER | WS_TABSTOP, 125, 615, 59, 12
 CONTROL "168", 168, "EDIT", WS_BORDER | WS_TABSTOP, 187, 615, 65, 12
 CONTROL "169", 169, "EDIT", WS_BORDER | WS_TABSTOP, 254, 615, 92, 12
 CONTROL "170", 170, "EDIT", WS_BORDER | WS_TABSTOP, 10, 655, 96, 12
 CONTROL "171", 171, "EDIT", WS_BORDER | WS_TABSTOP, 109, 655, 39, 12
 CONTROL "172", 172, "EDIT", WS_BORDER | WS_TABSTOP, 151, 655, 56, 12
 CONTROL "173", 173, "EDIT", WS_BORDER | WS_TABSTOP, 210, 655, 66, 12
 CONTROL "174", 174, "EDIT", WS_BORDER | WS_TABSTOP, 279, 655, 68, 12
 CONTROL "175", 175, "EDIT", WS_BORDER | WS_TABSTOP, 11, 681, 184, 12
 CONTROL "176", 176, "EDIT", WS_BORDER | WS_TABSTOP, 197, 681, 55, 12
 CONTROL "177", 177, "EDIT", WS_BORDER | WS_TABSTOP, 254, 681, 92, 12
 CONTROL "178", 178, "EDIT", WS_BORDER | WS_TABSTOP, 11, 723, 131, 12
 CONTROL "179", 179, "EDIT", WS_BORDER | WS_TABSTOP, 145, 723, 101, 12
 CONTROL "180", 180, "EDIT", WS_BORDER | WS_TABSTOP, 249, 723, 97, 12
 CONTROL "181", 181, "EDIT", WS_BORDER | WS_TABSTOP, 10, 748, 78, 12
 CONTROL "182", 182, "EDIT", WS_BORDER | WS_TABSTOP, 90, 748, 53, 12
 CONTROL "183", 183, "EDIT", WS_BORDER | WS_TABSTOP, 145, 748, 63, 12
 CONTROL "184", 184, "EDIT", WS_BORDER | WS_TABSTOP, 210, 748, 66, 12
 CONTROL "185", 185, "EDIT", WS_BORDER | WS_TABSTOP, 279, 748, 68, 12
 CONTROL "186", 186, "EDIT", WS_BORDER | WS_TABSTOP, 10, 773, 158, 12
 CONTROL "187", 187, "EDIT", WS_BORDER | WS_TABSTOP, 170, 773, 176, 12
 LTEXT "Nome", -1, 9, 13, 197, 10
 LTEXT "Data Nasc.", -1, 209, 13, 68, 9
 LTEXT "Estado Civil", -1, 279, 13, 68, 10
 LTEXT "CPF", -1, 9, 39, 68, 9
 LTEXT "RG", -1, 80, 39, 68, 10
 LTEXT "Orgao Expeditor", -1, 150, 39, 56, 9
 LTEXT "Emissão", -1, 209, 39, 68, 10
 LTEXT "_", -1, 279, 39, 68, 10
 LTEXT "Naturalidade", -1, 10, 65, 45, 10
 LTEXT "Pai", -1, 80, 65, 32, 10
 LTEXT "Mae", -1, 209, 65, 32, 10
 LTEXT "Endereco Residencial", -1, 10, 90, 78, 9
 LTEXT "Bairro", -1, 253, 90, 32, 10
 LTEXT "Cidade", -1, 10, 116, 32, 9
 LTEXT "UF", -1, 196, 116, 32, 10
 LTEXT "CEP", -1, 253, 116, 32, 10
 LTEXT "Telefone", -1, 10, 141, 32, 10
 LTEXT "Celular", -1, 124, 141, 32, 10
 LTEXT "Tempo Resid.", -1, 240, 141, 49, 10
 LTEXT "Nome", -1, 10, 182, 32, 10
 LTEXT "CPF", -1, 207, 182, 32, 10
 LTEXT "RG", -1, 10, 207, 32, 10
 LTEXT "Emissao", -1, 144, 207, 32, 10
 LTEXT "Data Nasc.", -1, 248, 207, 57, 10
 LTEXT "Empresa onde trabalha", -1, 10, 232, 32, 9
 LTEXT "Telefone", -1, 196, 232, 32, 10
 LTEXT "Salario", -1, 253, 232, 32, 10
 LTEXT "Nome", -1, 9, 272, 197, 10
 LTEXT "Data Nasc.", -1, 209, 272, 68, 9
 LTEXT "CPF", -1, 279, 272, 68, 10
 LTEXT "Endereco", -1, 10, 297, 32, 9
 LTEXT "Bairro", -1, 186, 297, 32, 10
 LTEXT "Telefone", -1, 253, 297, 32, 10
 LTEXT "Cidade", -1, 10, 322, 32, 9
 LTEXT "CEP", -1, 186, 322, 32, 10
 LTEXT "RG", -1, 253, 322, 32, 10
 LTEXT "UF", -1, 147, 322, 32, 10
 LTEXT "Empresa onde trabalha", -1, 10, 348, 32, 9
 LTEXT "Telefone", -1, 196, 348, 32, 10
 LTEXT "Renda avalista", -1, 253, 348, 55, 10
 LTEXT "Empresa onde trabalha", -1, 10, 390, 32, 10
 LTEXT "CNPJ", -1, 207, 390, 32, 10
 LTEXT "Cargo", -1, 10, 415, 32, 9
 LTEXT "Renda", -1, 186, 415, 32, 10
 LTEXT "Telefone", -1, 253, 415, 32, 10
 LTEXT "Admissão", -1, 124, 415, 32, 10
 LTEXT "Endereco ", -1, 10, 440, 78, 9
 LTEXT "Bairro", -1, 253, 440, 32, 10
 LTEXT "Cidade", -1, 10, 465, 32, 9
 LTEXT "UF", -1, 196, 465, 32, 10
 LTEXT "CEP", -1, 253, 465, 32, 10
 LTEXT "Empresa Anterior", -1, 10, 490, 71, 10
 LTEXT "CNPJ", -1, 207, 490, 32, 10
 LTEXT "Telefone", -1, 10, 515, 32, 10
 LTEXT "Celular", -1, 124, 515, 32, 10
 LTEXT "End.Cobrança", -1, 240, 515, 49, 10
 LTEXT "Banco", -1, 9, 555, 197, 10
 LTEXT "Agencia", -1, 209, 555, 68, 9
 LTEXT "Conta Corrente", -1, 279, 555, 68, 10
 LTEXT "Endereco ", -1, 9, 580, 78, 9
 LTEXT "Telefone", -1, 252, 580, 32, 10
 LTEXT "Nome(Pessoais)", -1, 10, 605, 64, 9
 LTEXT "Comercial/Pessoal", -1, 186, 605, 66, 10
 LTEXT "Telefone", -1, 253, 605, 32, 10
 LTEXT "Telefone", -1, 124, 605, 32, 10
 LTEXT "Marca", -1, 9, 645, 68, 9
 LTEXT "Ano", -1, 109, 645, 24, 10
 LTEXT "Modelo", -1, 150, 645, 56, 9
 LTEXT "Placa", -1, 209, 645, 68, 10
 LTEXT "Renavam", -1, 279, 645, 68, 10
 LTEXT "Chassi", -1, 10, 671, 32, 9
 LTEXT "Cor", -1, 196, 671, 32, 10
 LTEXT "Combustivel", -1, 253, 671, 48, 10
 LTEXT "Valor", -1, 10, 713, 32, 10
 LTEXT "Entrada", -1, 144, 713, 32, 10
 LTEXT "Valor do Credito Financiado", -1, 248, 713, 96, 10
 LTEXT "Valor da TAC", -1, 9, 738, 68, 9
 LTEXT "Tabela", -1, 90, 738, 24, 10
 LTEXT "Coeficiente", -1, 144, 738, 56, 9
 LTEXT "Prazo", -1, 209, 738, 68, 10
 LTEXT "Carencia", -1, 279, 738, 68, 10
 LTEXT "Valor da Parcela", -1, 9, 763, 71, 10
 LTEXT "Primeiro Vencimento", -1, 169, 763, 73, 10
 PUSHBUTTON "Confirma Operação", 88, 192, 794, 76, 14
 PUSHBUTTON "Cancela Operação", 89, 270, 794, 82, 14
}
Codigo do TPages.PRG modificado para aceitar scroll. Podemos usa-la enquanto o Antonio Linhares não nos presenteia com a sua versão final.

Codigo do TPages.PRG:

Code: Select all

// TPages Class. Used for managing a group of child DialogBoxes
//
// Modified Version to alow scroll with pages in 2006-12-30
// Rochinha - Brasil - email:irochinha@itelefonica.com.br
//

#include "FiveWin.ch"

#define COLOR_BTNFACE  15

#ifdef __XPP__
   #define Super ::TControl
   #define New   _New
#endif

//----------------------------------------------------------------------------//

CLASS TPages FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA   nOption
   DATA   aDialogs
   DATA   aScrolls // By Rochinha - Brasil

   METHOD New( nTop, nLeft, nBottom, nRight, oWnd ) CONSTRUCTOR

   METHOD Redefine( nId, oWnd, aDialogs, nOption, bChange, oFont ) CONSTRUCTOR

   METHOD AddPage( oControl )

   #ifndef __CLIPPER__
      METHOD cToChar() INLINE Super:cToChar( "SysTabControl32" )
   #endif

   METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()

   METHOD Default()

   METHOD DelPage( nPage )

   METHOD Destroy()
   
   METHOD SetOption( nOption )

   METHOD GoPrev() INLINE If( ::nOption > 1,;
                              ::SetOption( ::nOption - 1 ),)

   METHOD GoNext() INLINE If( ::nOption < Len( ::aDialogs ),;
                              ::SetOption( ::nOption + 1 ),)
   METHOD GotFocus()

   METHOD ReSize( nType, nWidth, nHeight )

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( nTop, nLeft, nBottom, nRight, oWnd ) CLASS TPages

   DEFAULT nTop := 0, nLeft := 0, nBottom := 100, nRight := 100,;
           oWnd := GetWndDefault()

   #ifdef __XPP__
      #undef New
   #endif

   ::nTop     = nTop
   ::nLeft    = nLeft
   ::nBottom  = nBottom
   ::nRight   = nRight
   ::oWnd     = oWnd
   ::nStyle   = nOr( WS_CHILD, WS_VISIBLE )
   ::nClrPane = GetSysColor( COLOR_BTNFACE )
   ::nOption  = 1
   ::aDialogs = {}
   ::lDrag    = .f.

   #ifdef __XPP__
      DEFAULT ::lRegistered := .f.
   #endif

   ::Register()

   if ! Empty( ::oWnd:hWnd )
      #ifdef __CLIPPER__
         ::Create()
      #else       
         ::Create( "SysTabControl32" )
      #endif   
      ::oWnd:AddControl( Self )
   else
      ::oWnd:DefControl( Self )
   endif

return Self

//----------------------------------------------------------------------------//

METHOD Redefine( nId, oWnd, aDialogs, nOption, bChange, oFont ) CLASS TPages

   local n, oDlg

   DEFAULT nOption := 1 , oFont := ::GetFont()

   ::nId     = nId
   ::oWnd    = oWnd
   ::nOption = nOption
   ::bChange = bChange
   ::aDialogs = Array( Len( aDialogs ) )
   ::oFont  := oFont

   ::Register()
   ::SetColor( 0, GetSysColor( COLOR_BTNFACE ) )

   for n = 1 to Len( aDialogs )
      DEFINE DIALOG oDlg OF Self RESOURCE aDialogs[ n ] FONT Self:oFont ;
         STYLE nor( WS_VSCROLL, WS_HSCROLL ) // Added By Rochinha - Brasil
      ::aDialogs[ n ] = oDlg
   next

   oWnd:DefControl( Self )

return Self

//----------------------------------------------------------------------------//

METHOD AddPage( oControl ) CLASS TPages

   AAdd( ::aDialogs, oControl )

   if ::oWnd:hWnd != nil
      #ifndef __XPP__
         oControl:nWidth  = ::nWidth()
         oControl:nHeight = ::nHeight()
      #else
         WndWidth( oControl:hWnd, ::nWidth() )
         WndHeight( oControl:hWnd, ::nHeight() )
      #endif

      ACTIVATE DIALOG oControl NOWAIT ;
         ON INIT ( SysWait(), oControl:Move( 0, 0 ) ) ;
         VALID .f.

      #ifndef __CLIPPER__
         if IsAppThemed()
            oControl:bEraseBkGnd = { | hDC | DrawPBack( oControl:hWnd, hDC ), 1 }
         endif
      #endif

      ::SetOption( Len( ::aDialogs ) )
   endif

return nil

//----------------------------------------------------------------------------//

METHOD Default() CLASS TPages

   local n, oDlg
   
   for n = 1 to Len( ::aDialogs )
      oDlg = ::aDialogs[ n ]

      /* ************ MODIFIED BY Rochinha - Brasil ************* */
      if ::aScrolls[ n ] = .t.
         /* ************ CALCULO MALUCO ************ */
         nMHeight := (((::nTop+::nHeight)*10)/::nHeight)/10
         ACTIVATE DIALOG oDlg NOWAIT ;
         ON INIT ( SysWait(), oDlg:Move( 0, 0 ),;
                   TScrDlg():New(oDlg,0,::nHeight/16,0,::nWidth/8),;
                   oDlg:SetSize( ::nWidth, (::nHeight/(nMHeight*3)) ) ) ;
         VALID .f.
         /* ************ CALCULO MALUCO ************ */
      else
         ACTIVATE DIALOG oDlg NOWAIT ;
         ON INIT ( SysWait(), oDlg:Move( 0, 0 ) );
         VALID .f.         // to avoid exiting pressing Esc !!!
      endif
      /* ************ MODIFIED BY Rochinha - Brasil ************* */

      #ifndef __CLIPPER__
         if IsAppThemed()
            oDlg:bEraseBkGnd = { | hDC | DrawPBack( oDlg:hWnd, hDC ), 1 }
         endif
      #endif

      oDlg:Hide()
   next

   if Len( ::aDialogs ) > 0
      if ::nOption <= Len( ::aDialogs )
         ::aDialogs[ ::nOption ]:Show()
      endif
   endif

return nil

//----------------------------------------------------------------------------//

METHOD DelPage( nPage ) CLASS TPages

   local nNewPage

   DEFAULT nPage := ::nOption

   if nPage > 0 .and. nPage <= Len( ::aDialogs )
      ::aDialogs[ nPage ]:bValid = { || .t. }
      ::aDialogs[ nPage ]:End()
      SysRefresh()
      ADel( ::aDialogs, nPage )
      ASize( ::aDialogs, Len( ::aDialogs ) - 1 )
      if Len( ::aDialogs ) > 0
         nNewPage = If( nPage > 1, nPage - 1, 1 )
         if ::bChange != nil
            Eval( ::bChange, nNewPage, nPage )
         endif
         ::nOption  = nNewPage
         ::aDialogs[ nNewPage ]:Show()
         ::aDialogs[ nNewPage ]:SetFocus()
      endif
   endif

return nil

//----------------------------------------------------------------------------//

METHOD Destroy() CLASS TPages

   local n

   for n = 1 to Len( ::aDialogs )
      ::aDialogs[ n ]:bValid = { || .t. }
      ::aDialogs[ n ]:End()
      SysRefresh()
   next

return Super:Destroy()

//----------------------------------------------------------------------------//

METHOD GotFocus() CLASS TPages

   Super:GotFocus()

   if ::nOption <= Len( ::aDialogs )
      ::aDialogs[ ::nOption ]:SetFocus()
   endif

return 0

//----------------------------------------------------------------------------//

METHOD SetOption( nOption ) CLASS TPages

   local nOldOption

   if nOption > 0 .and. nOption != ::nOption
      if ::nOption <= Len( ::aDialogs ) .and. ::aDialogs[ ::nOption ] != nil
         ::aDialogs[ ::nOption ]:Hide()
      endif
      nOldOption = ::nOption
      ::nOption  = nOption
      if nOption <= Len( ::aDialogs ) .and. ::aDialogs[ nOption ] != nil
         if ::bChange != nil
            Eval( ::bChange, nOption, nOldOption )
         endif
         ::aDialogs[ nOption ]:Show()
         ::aDialogs[ nOption ]:SetFocus()
      endif
   endif

return nil

//----------------------------------------------------------------------------//

METHOD Resize( nType, nWidth, nHeight ) CLASS TPages

   local n

   DEFAULT nWidth := ::nWidth(), nHeight := ::nHeight

   for n = 1 to Len( ::aDialogs )
      ::aDialogs[ n ]:SetSize( nWidth, nHeight )
   next

return Super:Resize( nType, nWidth, nHeight )

//----------------------------------------------------------------------------//

Posted: Sat Dec 30, 2006 7:53 pm
by Antonio Linares
Rochinha,

Thanks!

Anyhow we have planned a different implementation

Posted: Sat Dec 30, 2006 10:22 pm
by Rochinha
Thanks

We will be waiting with certainty. But while this…

Posted: Tue Jan 02, 2007 11:08 am
by Maurilio Viana
Antonio,

Many classes of Fivewin we have any like:

Code: Select all

for n := 1 to len(aAnything)
      ...
next
Could I suggest a little optimization?

Code: Select all

LOCAL nLen := Len(aAnything)
...
for n := 1 to nLen
     ...
next
I do it in my modified FW class. Is a little optimization but avoid to eval len(aAnytihing) each loop. I do it in FOR, WHILE, etc.

Regards,
Maurilio

Posted: Tue Jan 02, 2007 11:24 am
by Maurilio Viana
Rochinha,

Muito legal! Só um pitaco: voce esqueceu de declarar nMHeight no método Default de TPages.

Very good! Only a tip: you forgot to declare nMHeight in Default method from TPages.

Code: Select all

METHOD Default() CLASS TPages
 local n, oDlg
 local nMHeight   // <------
Abraços/Regards
Maurilio

Posted: Tue Jan 02, 2007 2:08 pm
by Rochinha
Valew!!!

Dialog com scroll...

Posted: Tue Oct 23, 2007 3:27 pm
by siscat
Rochinha, boa tarde

baixei estes fontes relativos a Scrollbar na Dialog e na TPage más pra mim não funcionaram...

vc sabe se tem alguma restrição quanto a versão do FWH .. estou utilizando a 2.8 / xHarbour

[]s

Posted: Wed Oct 24, 2007 5:22 am
by Rochinha
Amiguinho

Na verdade até a versão 2.7 este recurso serviria, mas como voce possui a 2.8 provavelmente ele ja seja suportado.

De uma olhada em sua classe TPages.PRG e verifique se ha diferenças.

Re: How to put scrollbar in dialog?

Posted: Thu Dec 10, 2009 1:22 am
by hua
Hi Rossine, Rochinha,
Do you guys have any updated sample where the mouse wheel is supported?

TIA.

Re: How to put scrollbar in dialog?

Posted: Thu Dec 10, 2009 3:25 pm
by Antonio Linares