consulta en xbrowse

consulta en xbrowse

Postby surGom » Mon Dec 31, 2012 10:40 pm

Estoy tratando de cambiar wbrowse de Hernán por xbrowse y tengo algunas dudas. Estoy trabajando sobre un array y con wbrowse cuando en una celda determinada el codigo era 0 abría un diálogo en el cual buscaba por intermedio del teclado el producto buscado de esta forma

Code: Select all  Expand view

STATIC Function EditaCelda( oBrw, nCol, cBuffer, aDet, lFirstEdit,lpedido,oHasedro)
 LOCAL aResult, nAt:= oBrw:nAt, uBuffer, lContinue:= .t.
 LOCAL bValid, nColReal:= nCol
 LOCAL aProd


    nCol--  // Para que sea como si no exisiera BitMap
    uBuffer:= aDet[nAt,nCol]
    if !lpedido .and. ncol = 6 .and. !empty(nComision)
             uBuffer := nComision
    endif

    While .t.

       Do Case
          Case ( nCol == 4 .and. nCol == 3 ) .and. lFirstEdit
               Alert( "Columnas NO EDITABLES" )
               return .f.

          Case nCol == 1
               bValid:= {||  aProd := bprodu(ubuffer),bbvalid(@aProd,acliente:cedronar,acliente:nclia,acliente:vtocedro, acliente:inv,oHasedro) }

              If lContinue:= oBrw:lEditCol( nColReal, @uBuffer, "@ZE 9999", bValid,,CLR_YELLOW)
                  aDet[nAt,1]:= aProd[1]                   //código
                  aDet[nAt,3]:= aProd[3]                   //unidad de medida
                  aDet[nAt,4]:= aProd[2]                   //producto  
                  aDet[nAt,7]:= aProd[4]                   // envase                      
               EndIf

          Case nCol == 2  // Cantidad   // etc.....
 


En aProd cargo los datos del producto, código, nombre, envase, unidad de medida, que se muestran en el browse en distintas columnas

En xbrowse el código que utilizo para que me muestre el array es el siguiente

Code: Select all  Expand view

REDEFINE XBROWSE  oBrw  id 108 of odlg update  columns 1,2,3,4,5,6 ;
                                          COLSIZES 50,70,50,250,120,70;
                                          HEADER "Código", "Cantidad", " ", "Producto","Envase", "Comisión" ;
                      PICTURE "9999", "@E 999,999.99",,"@!",,"999.99";
                                          array aDET lines cell fastedit
                     
                                            oBrw:nEditTypes   := EDIT_GET
                                            oBrw:lAutoAppend  := .t.
 


Funciona bien pero no se como hago para poder en la columna 1 hacer lo que hacía con el wbrowse, hice algunas pruebas pero no encuentro la forma.

Muchas Gracias

Feliz año nuevo
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: consulta en xbrowse

Postby surGom » Thu Jan 03, 2013 2:40 pm

Bueno gracias a un ejemplo de joseluisysturiz,viewtopic.htm#p133887 hice el siguiente código y funciona parcialmente

Code: Select all  Expand view

REDEFINE XBROWSE  oBrw  id 108 of odlg update ;
                                           columns 1,2,3,4,5,6 ;
                                          COLSIZES 50,70,50,250,120,70;
                                          HEADER "Código", "Cantidad", " ", "Producto","Envase", "Comisión" ;
                      PICTURE "9999", "@E 999,999.99",,"@!",,"999.99";
                                          array aDET lines cell fastedit

WITH OBJECT oBrw
 :nMarqueeStyle := MARQSTYLE_HIGHLCELL
 :nColDividerStyle := LINESTYLE_BLACK
 :nStretchCol := STRETCHCOL_LAST
 :lColDividerComplete := .t.
 :l2007 := .t.
 :lRecordSelector := .t.
 :lAllowColHiding := .f.
 :lAllowColSwapping := .f.

 END WITH

WITH OBJECT oBrw:aCols[1]attachment:/1/
 :bStrData := {|| IIF( LEN( aDet ) = 0, 0 ,;
 aDet[oBrw:nArrayAt, 1] ) }
 :cEditPicture := "99999"
 :nFootStrAlign := AL_RIGHT
 :nEditType := EDIT_GET
 :bEditValid := { | oGet, oCol | aProd := bProdu( oGet:value()),aDet[oBrw:nArrayAt, 1]  := aProd[1] }
 :bOnPostEdit := { | oCol, xVal, nKey | If( nKey <> VK_ESCAPE ,oCol:value := xVal, ) }
 
 
 END WITH


    oBrw:SetArray(aDet)
 


.dónde aProd es un array que cargo con los datos con los datos del producto pero me da el siguiente error

Code: Select all  Expand view

  Error occurred at: 03/01/2013, 10:42:25
   Error description: Error BASE/1066  Argument error: conditional
   Args:
     [   1] = N   569

Stack Calls
===========
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBRWCOLUMN:EDIT( 10598 )
   Called from: .\source\classes\TGET.PRG => TGET:LVALID( 1184 )
   Called from: .\source\classes\WINDOW.PRG => (b)TWINDOW:TWINDOW( 326 )
   Called from:  => TWINDOW:END( 0 )
   Called from: .\source\classes\CONTROL.PRG => TGET:END( 778 )
   Called from: .\source\classes\XBROWSE.PRG => EDITGETKEYDOWN( 10762 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBRWCOLUMN:EDIT( 10604 )
   Called from: .\source\classes\TGET.PRG => TGET:KEYDOWN( 792 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1700 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 579 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
   Called from:  => DIALOGBOX( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: e:\fiveh12\maepido.prg => PEDIDOVE( 96 )
   Called from: e:\fiveh12\origen.prg => (b)ORIGEN( 153 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 465 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 656 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1690 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1407 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 980 )
   Called from: e:\fiveh12\origen.prg => ORIGEN( 202 )
 


Me podrían indicar cual es el error

Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: consulta en xbrowse

Postby surGom » Fri Jan 04, 2013 10:40 am

Estaba aplicando mal la claúsula :bEditValid ahora lo hice así

Code: Select all  Expand view

 :bEditValid := { | oGet, oCol | valido( oGet:value(),oBrw,oHasedro)  }  

....etc etc

 function valido(nValor,oBrw,oHasedro)
 local aProd := bprodu(nValor)

 if len(aProd) > 0
     if bbvalid(aProd,acliente:cedronar,acliente:nclia,acliente:vtocedro, acliente:inv,oHasedro)
       aDet[oBrw:nArrayAt, 1]  :=aProd[1]
       aDet[oBrw:nArrayAt,3]:= aProd[3]
       aDet[oBrw:nArrayAt,4]:= aProd[2]
       aDet[oBrw:nArrayAt,7]:= aProd[4]
       oBrw:refresh()
       return .t.
    endif
endif
return .f.

 


Y ahora sí funciona

Gracias
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests