Page 1 of 1

Ayuda con xbrowse

PostPosted: Fri Jan 30, 2009 2:24 am
by laugusto
Buenas,

Pos es esto, tengo la seguinte rutina:

Code: Select all  Expand view

   TWBrowse():lHScroll := .F.
   @ 1,2 LISTBOX oBrw;
      FIELDS Str(a_temp[n][01],05,0 ),;
             a_temp[n][02],;
             Dtoc( a_temp[n][03] ),;
             a_temp[n][04], a_temp[n][05];
      HEADERS "No. Ped",;
              "Cliente",;
              "DtaPed",;
              "Situação",;
              "Tipo" FONT oFont OF oDlg SIZE 300, 130
   
   oBrw:bGotop       := { || n := 1 }
   oBrw:bGoBottom    := { || n := Eval( oBrw:bLogicLen ) }
   oBrw:bSkip        := { | nwant, nold | nold := n , n += nwant, n := Max( 1, Min( n, Eval( oBrw:bLogicLen ) ) ), n - nOld }
   oBrw:bLogicLen    := { || len( a_temp ) }

   oBrw:bLDblClick   := { | nRow, nCol | ctick := a_temp[n][1], npedido := ctick, Scv20201A( oWnd, ctick ),;
                            IF( lRet,( lAcao := .t., oDlg:End() ),) }

   oBrw:nDlgCode   := DLGC_WANTALLKEYS
   oBrw:CreateFromCode()
   
   // Força o browse trabalhar com celulas
   oBrw:lCellStyle   := .t.
   oBrw:nLineStyle   :=  4
   oBrw:nClrForeHead := CLR_BLUE

   // Lets use different row colors
   oBrw:nClrText     := { || Scv20222( a_temp[n][04] ) }

//----------------------------------------------------------------------------//
FUNCTION Scv20222( cCampo )  // Cores no Browse

   local nColor

   IF cCampo = "FECHADO" .or. cCampo = "CANCELADO"
      nColor := nRGB( 0, 0, 0 )  // Preto
   ElseIF cCampo = "ABERTO"
      nColor := nRGB( 0, 0, 183 ) // Azul
   ElseIF cCampo = "PENDENTE"
      nColor := nRGB( 255, 0, 0 ) // Vermelho
   ElseIF cCampo = "NOVO"
      nColor := nRGB( 0, 128, 0 ) // Verde
   EndIF

Return nColor



necesito una ayuda para utilizar el codigo con xbrowse, as linhas abajo no funcionam co xbrowse
Code: Select all  Expand view
   
   oBrw:bGotop       := { || n := 1 }
   oBrw:bGoBottom    := { || n := Eval( oBrw:bLogicLen ) }
   oBrw:bSkip        := { | nwant, nold | nold := n , n += nwant, n := Max( 1, Min( n, Eval( oBrw:bLogicLen ) ) ), n - nOld }
   oBrw:bLogicLen    := { || len( a_temp ) }


e esta chamada a function tambien no
Code: Select all  Expand view
   // Lets use different row colors
   oBrw:nClrText     := { || Scv20222( a_temp[n][04] ) }


gracias en adelantado,
Saludos desde Brasil

Re: Ayuda con xbrowse

PostPosted: Fri Jan 30, 2009 11:04 am
by jrestojeda
Hola amigo...
Prueba de la siguiente manera:
Code: Select all  Expand view
   oLbx1:bGoTop   :={||n:=1 }
   oLbx1:bGoBottom:={||n:=Len(a_temp)}
   oLbx1:bBookMark:={|nBkm| If( nBkm == nil, n, n:= nBkm ) }
   oLbx1:bSkip    :={|nSkip| Skipper2(a_temp,@n,@nSkip ) }


Función Skipper2:
Code: Select all  Expand view
Function Skipper2(Vector,nCur,nSkip)
Local nOld:=nCur

Default nSkip:= 1
nCur :=nCur + nSkip
IF nCur > LEN(Vector)
   nCur:= LEN(Vector)
ENDIF
IF nCur < 1
   nCur:= 1
ENDIF

Return nCur - nOld


Espero te funcione...
Saludos desde Argentina, Esteban.

Re: Ayuda con xbrowse( Resolvido )

PostPosted: Sun Feb 01, 2009 2:13 pm
by laugusto
Buenos Dias,

Gracias Esteban por contestar, funciono de pronto su rotina.

Saludos desde Brasil,
Luiz Augusto

Re: Ayuda con xbrowse

PostPosted: Sun Feb 01, 2009 2:18 pm
by jrestojeda
Augusto...
Me alegro saber que funcionó.

Saludos desde Argentina, Esteban.