FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour consulta en xbrowse
Posts: 652
Joined: Wed Oct 19, 2005 12:03 PM
consulta en xbrowse
Posted: 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 (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 652
Joined: Wed Oct 19, 2005 12:03 PM
Re: consulta en xbrowse
Posted: Thu Jan 03, 2013 02:40 PM
Bueno gracias a un ejemplo de joseluisysturiz,viewtopic.htm#p133887 hice el siguiente c贸digo y funciona parcialmente

Code (fw): Select all Collapse
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 (fw): Select all Collapse
  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
Posts: 652
Joined: Wed Oct 19, 2005 12:03 PM
Re: consulta en xbrowse
Posted: Fri Jan 04, 2013 10:40 AM
Estaba aplicando mal la cla煤sula :bEditValid ahora lo hice as铆

Code (fw): Select all Collapse
 :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

Continue the discussion