Copiar um browse

Post Reply
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Copiar um browse

Post by Rossine »

Olá,

Preciso criar um novo browse em uma dialog com as mesmas propriedades de um outro browse que está em outra dialog. Tem como fazer isto ?

Obrigado,

Rossine.
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Copiar um browse

Post by karinha »

Rossine wrote:Olá,

Preciso criar um novo browse em uma dialog com as mesmas propriedades de um outro browse que está em outra dialog. Tem como fazer isto ?

Obrigado,

Rossine.
Hola Rossine,

Seja mais especifico:

Em @say... ou Editor de Recursos?

Se a Browse inicial esta no mesmo modulo, podes usar o comando oClone(). Para Clonar o o Objeto da Browse inicial para a Proxima Browse .

Code: Select all

    oDbLbx:= oClone( oDbfClientes )
Tens a mesma LISTBOX em qualquer lugar.

Se entendi...
João Santos - São Paulo - Brasil
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá João,

Veja o exemplo abaixo:

O interessante é que, quando você clica no botão "próximo", a segunda dialog é mostrada, o browse não aparece, mas o browse que é atualizado nas novas coordenadas, é o do 1º browse.

Mais alguma dica ?

Obrigado,

Rossine.
Last edited by Rossine on Fri Feb 08, 2008 4:52 pm, edited 4 times in total.
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Desculpem, aqui está o código (hehe) :lol:

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"

function MAIN

   local oDlg, oBrw, aStruc := { { "teste", "teste", "teste", "teste" }, ;
                                 { "teste", "teste", "teste", "teste" }, ;
                                 { "teste", "teste", "teste", "teste" }, ;
                                 { "teste", "teste", "teste", "teste" }, ;
                                 { "teste", "teste", "teste", "teste" } }

   define dialog oDlg from 0, 0 to 300, 310 pixel

   oBrw := TXBrowse():New( oDlg )

   oBrw:SetArray( aStruc)

   oBrw:nTop    := 10
   oBrw:nLeft   := 10
   oBrw:nRight  := 150
   oBrw:nBottom := 100

   oBrw:aCols[1]:cHeader := Padr("NAME", 15)

   oBrw:aCols[2]:cHeader       := "TYPE"
   oBrw:aCols[2]:nDataStrAlign := AL_CENTER
   oBrw:aCols[2]:nHeadStrAlign := AL_CENTER

   oBrw:aCols[3]:cHeader       := "SIZE"
   oBrw:aCols[3]:nDataStrAlign := AL_RIGHT
   oBrw:aCols[3]:nHeadStrAlign := AL_RIGHT

   oBrw:aCols[4]:cHeader       := "LENGTH"
   oBrw:aCols[4]:nDataStrAlign := AL_RIGHT
   oBrw:aCols[4]:nHeadStrAlign := AL_RIGHT

   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLCELL
   oBrw:lRecordSelector := .f.

   oBrw:CreateFromCode()

   oDlg:oClient := oBrw

   @120, 60 button oBtn prompt "Proximo" of oDlg action DLG2( oBrw ) pixel

   activate dialog oDlg on init oBrw:SetFocus() centered

RETURN NIL

static function DLG2( oBrw )

   local oDlg1, oBrw1

   define dialog oDlg1 from 200, 200 to 500, 510 pixel

   oBrw1 := oClone( oBrw )

   oBrw1:delcol(2)

   oBrw1:nTop    := 0
   oBrw1:nLeft   := 0
   oBrw1:nRight  := 10
   oBrw1:nBottom := 50

   oBrw1:oWnd    := oDlg1

   activate dialog oDlg1 on init oBrw1:SetFocus()

RETURN NIL
Abraços,

Rossine.
User avatar
RenOmaS
Posts: 205
Joined: Fri Oct 07, 2005 5:07 pm

Post by RenOmaS »

Acho que vc. tem que clonar en el on init del dialog

Code: Select all

 define dialog oDlg1 from 200, 200 to 500, 510 pixel
 oBrw1:CreateFromCode()
 activate dialog oDlg1 on init InitBrowse( oBrw1, oBrw

...

Static Function InitBrowse( oBrw1, oBrw )
oBrw1 := oClone( oBrw )

   oBrw1:delcol(2)

   oBrw1:nTop    := 0
   oBrw1:nLeft   := 0
   oBrw1:nRight  := 10
   oBrw1:nBottom := 50 

  Return Nil
vc va a utilizar o mesmo alias no segundo browse?

salu2
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post by karinha »

Code: Select all

#INCLUDE "FIVEWIN.CH"
#INCLUDE "XBROWSE.CH"

FUNCTION MAIN

   LOCAL ODLG, OBRW, ASTRUC := { { "TESTE", "TESTE", "TESTE", "TESTE" }, ;
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ;
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ;
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ;
                                 { "TESTE", "TESTE", "TESTE", "TESTE" } }

   DEFINE DIALOG ODLG FROM 0, 0 TO 300, 310 PIXEL

   OBRW := TXBROWSE():NEW( ODLG )

   OBRW:SETARRAY( ASTRUC)

   OBRW:NTOP    := 10
   OBRW:NLEFT   := 10
   OBRW:NRIGHT  := 150
   OBRW:NBOTTOM := 100

   OBRW:ACOLS[1]:CHEADER := PADR("NAME", 15)

   OBRW:ACOLS[2]:CHEADER       := "TYPE"
   OBRW:ACOLS[2]:NDATASTRALIGN := AL_CENTER
   OBRW:ACOLS[2]:NHEADSTRALIGN := AL_CENTER

   OBRW:ACOLS[3]:CHEADER       := "SIZE"
   OBRW:ACOLS[3]:NDATASTRALIGN := AL_RIGHT
   OBRW:ACOLS[3]:NHEADSTRALIGN := AL_RIGHT

   OBRW:ACOLS[4]:CHEADER       := "LENGTH"
   OBRW:ACOLS[4]:NDATASTRALIGN := AL_RIGHT
   OBRW:ACOLS[4]:NHEADSTRALIGN := AL_RIGHT

   OBRW:NMARQUEESTYLE   := MARQSTYLE_HIGHLCELL
   OBRW:LRECORDSELECTOR := .F.

   OBRW:CREATEFROMCODE()

   ODLG:OCLIENT := OBRW

   @120, 60 BUTTON OBTN PROMPT "PROXIMO" OF ODLG ;
            ACTION DLG2( OBRW, ASTRUC, ODLG ) PIXEL

   ACTIVATE DIALOG ODLG   CENTERED ;
            ON INIT OBRW:SETFOCUS()

RETURN NIL

STATIC FUNCTION DLG2( OBRW, ASTRUC, ODLG )

   LOCAL ODLG1, OBRW1

   DEFINE DIALOG ODLG1 FROM 200, 200 TO 500, 510 PIXEL


   OBRW1 := OCLONE( OBRW, ASTRUC, ODLG )

   OBRW1 := TXBROWSE():NEW( ODLG1 )

   OBRW1:SETARRAY( ASTRUC )

   OBRW1:NTOP    := 10
   OBRW1:NLEFT   := 10
   OBRW1:NRIGHT  := 150
   OBRW1:NBOTTOM := 100

   OBRW1:ACOLS[1]:CHEADER := PADR("NAME", 15)

   OBRW1:ACOLS[2]:CHEADER       := "TYPE"
   OBRW1:ACOLS[2]:NDATASTRALIGN := AL_CENTER
   OBRW1:ACOLS[2]:NHEADSTRALIGN := AL_CENTER

   OBRW1:ACOLS[3]:CHEADER       := "SIZE"
   OBRW1:ACOLS[3]:NDATASTRALIGN := AL_RIGHT
   OBRW1:ACOLS[3]:NHEADSTRALIGN := AL_RIGHT

   OBRW1:ACOLS[4]:CHEADER       := "LENGTH"
   OBRW1:ACOLS[4]:NDATASTRALIGN := AL_RIGHT
   OBRW1:ACOLS[4]:NHEADSTRALIGN := AL_RIGHT

   OBRW1:NMARQUEESTYLE   := MARQSTYLE_HIGHLCELL
   OBRW1:LRECORDSELECTOR := .F.

   OBRW1:CREATEFROMCODE()

   ODLG1:OCLIENT := OBRW1

   /*
   OBRW1:SETARRAY( ASTRUC )

   OBRW1:DELCOL(2)

   OBRW1:NTOP    := 0
   OBRW1:NLEFT   := 0
   OBRW1:NRIGHT  := 10
   OBRW1:NBOTTOM := 50

   OBRW1:OWND    := ODLG1
   */

   ACTIVATE DIALOG ODLG1 ON INIT OBRW1:SETFOCUS()

RETURN NIL
João Santos - São Paulo - Brasil
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá Renomas,
Acho que vc. tem que clonar en el on init del dialog

Code:

define dialog oDlg1 from 200, 200 to 500, 510 pixel
oBrw1:CreateFromCode()
activate dialog oDlg1 on init InitBrowse( oBrw1, oBrw

...

Static Function InitBrowse( oBrw1, oBrw )
oBrw1 := oClone( oBrw )

oBrw1:delcol(2)

oBrw1:nTop := 0
oBrw1:nLeft := 0
oBrw1:nRight := 10
oBrw1:nBottom := 50

Return Nil
Isto não funcionou.
vc va a utilizar o mesmo alias no segundo browse?
Sim.

Olá João,

Isto realmente funciona, mas vou ter que especificar propriedade por propriedade.

Code: Select all

#INCLUDE "FIVEWIN.CH" 
#INCLUDE "XBROWSE.CH" 

FUNCTION MAIN 

   LOCAL ODLG, OBRW, ASTRUC := { { "TESTE", "TESTE", "TESTE", "TESTE" }, ; 
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ; 
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ; 
                                 { "TESTE", "TESTE", "TESTE", "TESTE" }, ; 
                                 { "TESTE", "TESTE", "TESTE", "TESTE" } } 

   DEFINE DIALOG ODLG FROM 0, 0 TO 300, 310 PIXEL 

   OBRW := TXBROWSE():NEW( ODLG ) 

   OBRW:SETARRAY( ASTRUC) 

   OBRW:NTOP    := 10 
   OBRW:NLEFT   := 10 
   OBRW:NRIGHT  := 150 
   OBRW:NBOTTOM := 100 

   OBRW:ACOLS[1]:CHEADER := PADR("NAME", 15) 

   OBRW:ACOLS[2]:CHEADER       := "TYPE" 
   OBRW:ACOLS[2]:NDATASTRALIGN := AL_CENTER 
   OBRW:ACOLS[2]:NHEADSTRALIGN := AL_CENTER 

   OBRW:ACOLS[3]:CHEADER       := "SIZE" 
   OBRW:ACOLS[3]:NDATASTRALIGN := AL_RIGHT 
   OBRW:ACOLS[3]:NHEADSTRALIGN := AL_RIGHT 

   OBRW:ACOLS[4]:CHEADER       := "LENGTH" 
   OBRW:ACOLS[4]:NDATASTRALIGN := AL_RIGHT 
   OBRW:ACOLS[4]:NHEADSTRALIGN := AL_RIGHT 

   OBRW:NMARQUEESTYLE   := MARQSTYLE_HIGHLCELL 
   OBRW:LRECORDSELECTOR := .F. 

   OBRW:CREATEFROMCODE() 

   ODLG:OCLIENT := OBRW 

   @120, 60 BUTTON OBTN PROMPT "PROXIMO" OF ODLG ; 
            ACTION DLG2( OBRW, ASTRUC, ODLG ) PIXEL 

   ACTIVATE DIALOG ODLG   CENTERED ; 
            ON INIT OBRW:SETFOCUS() 

RETURN NIL 

STATIC FUNCTION DLG2( OBRW, ASTRUC, ODLG ) 

   LOCAL ODLG1, OBRW1 

   DEFINE DIALOG ODLG1 FROM 200, 200 TO 500, 510 PIXEL 

   OBRW1 := TXBROWSE():NEW( ODLG1 ) 

   OBRW1:SETARRAY( ASTRUC ) 

   OBRW1:NTOP    := 10 
   OBRW1:NLEFT   := 10 
   OBRW1:NRIGHT  := 150 
   OBRW1:NBOTTOM := 100 

   for n = 1 to 4
       OBRW1:ACOLS[n]:CHEADER       := OBRW:ACOLS[n]:CHEADER      
       OBRW1:ACOLS[n]:NDATASTRALIGN := OBRW:ACOLS[n]:NDATASTRALIGN
       OBRW1:ACOLS[n]:NHEADSTRALIGN := OBRW:ACOLS[n]:NHEADSTRALIGN
   next

   OBRW1:DELCOL(2) 

   OBRW1:NMARQUEESTYLE   := MARQSTYLE_HIGHLCELL 
   OBRW1:LRECORDSELECTOR := .F. 

   OBRW1:CREATEFROMCODE() 

   ODLG1:OCLIENT := OBRW1 

   ACTIVATE DIALOG ODLG1 ON INIT OBRW1:SETFOCUS() 

RETURN NIL 
Mais alguma sugestão ?

Obrigado a todos,

Rossine.
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post by karinha »

Desculpe amigão, mas ahi, entra meus limites, não manjo nada de XBROWSE...

Talvez algum mestre em XBROWSE.
João Santos - São Paulo - Brasil
Post Reply