Les adjunto parte del codigo que utilizo, cualquier ayuda es de gran valor.
- Code: Select all Expand view
- oBrw := TXBrowse():New( oPanelCue )
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[1]:cHeader := "Item"
oBrw:aCols[1]:nWidth := 100
oBrw:aCols[1]:cDataType := "N"
oBrw:aCols[1]:nDataStrAlign := AL_CENTER
oBrw:aCols[1]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[1]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[1]:nHeadStrAlign := 2
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[2]:cHeader := "Código"
oBrw:aCols[2]:nWidth := 150
oBrw:aCols[2]:cDataType := "N"
oBrw:aCols[2]:nDataStrAlign := AL_CENTER
oBrw:aCols[2]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[2]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[2]:nHeadStrAlign := 2
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[3]:cHeader := "Producto"
oBrw:aCols[3]:nWidth := 300
oBrw:aCols[3]:cDataType := "C"
oBrw:aCols[3]:nDataStrAlign := AL_LEFT
oBrw:aCols[3]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[3]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[3]:nHeadStrAlign := 0 // 0=Izquierda 1=Derecha 2=Centrado
*-----------------------------------------------
oCol:=oBrw:AddCol()
oBrw:aCols[4]:cHeader := "Cantidad"
oBrw:aCols[4]:nWidth := 150
oBrw:aCols[4]:cDataType := "N"
oBrw:aCols[4]:cEditPicture := "@Z 9,999.999"
oBrw:aCols[4]:nDataStrAlign := AL_RIGHT
oBrw:aCols[4]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[4]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[4]:nHeadStrAlign := 2 // 0=Izquierda 1=Derecha 2=Centrado
oBrw:aCols[4]:nEdittype := EDIT_GET
oBrw:aCols[4]:bOnPostEdit := {|o,x,n|If(n=VK_RETURN,( oBrw:aArrayData[oBrw:nArrayAt,4]:=x,;
oBrw:aArrayData[oBrw:nArrayAt,7]:=x/oBrw:aArrayData[oBrw:nArrayAt,6] ),)}
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[5]:cHeader := "Uni.de Med."
oBrw:aCols[5]:nWidth := 150
oBrw:aCols[5]:cDataType := "N"
oBrw:aCols[5]:nDataStrAlign := AL_LEFT
oBrw:aCols[5]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[5]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[5]:nHeadStrAlign := 2
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[6]:cHeader := "Kg Bolsa"
oBrw:aCols[6]:nWidth := 150
oBrw:aCols[6]:cDataType := "N"
oBrw:aCols[6]:nDataStrAlign := AL_CENTER
oBrw:aCols[6]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[6]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[6]:nHeadStrAlign := 2
oBrw:aCols[6]:cEditPicture := "@Z 9,999.999"
*-----------------------------------------------
oCol := oBrw:AddCol()
oBrw:aCols[7]:cHeader := "Bolsas"
oBrw:aCols[7]:nWidth := 150
oBrw:aCols[7]:cDataType := "N"
oBrw:aCols[7]:nDataStrAlign := AL_CENTER
oBrw:aCols[7]:oDataFont := hFnt["BrwFC"]
oBrw:aCols[7]:oHeaderFont := hFnt["CabFC"]
oBrw:aCols[7]:nHeadStrAlign := 2
oBrw:aCols[7]:cEditPicture := "@Z 9,999.99"
*-----------------------------------------------
oBrw:aCols[1]:nHeaderType := 2 // Comienza el primer grupo
oBrw:aCols[2]:nHeaderType := 1
oBrw:aCols[3]:nHeaderType := 1
oBrw:aCols[4]:nHeaderType := 1
oBrw:aCols[5]:nHeaderType := 1
oBrw:aCols[6]:nHeaderType := 1
oBrw:aCols[7]:nHeaderType := 1
with object oBrw
:nHeaderLines := 1 // número de líneas de la cabecera
:nHeaderHeight := 100 // Altura cabeceras de columna
:nRowHeight := 50
:nHeader := 1
:aHeaderTop := {"I T E M D E L C O M P R O B A N T E"}
:nMarqueeStyle := 3//MARQSTYLE_HIGHLROW // Estilo marquesina (fila seleccionada) 0 No 1 Marquesina punteada celular 2 Solid celular 3 Resalte la celda 4 fila resaltada y Levante teléfono 5
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:bClrSel := {||{nRGB(255,255,255),nRGB(000,128,255)}}// para barra de linea selecc cuando el control no tiene el foco
:bClrHeader := {|| { nRGB(255,255,255), nRGB( 000, 000, 000 ), } }
:nStretchCol := STRETCHCOL_WIDEST // ajusta la ultima columna al limite derecho del browse
:l2007 := (.F.)
:lAllowColHiding := .F. // Anulo el menu contextual al hacer click sobre el Header del browse
:lRecordSelector := .F. //poner o no, COL de la flechita de la izq
:bClrStd := { || { CLR_BLACK, If(oBrw:KeyNo % 2 == 0, RGB(193,221,255), RGB(221,245,255) ) } } // colores para lineas normales
:lHScroll := .F.
:lVScroll := .F.
:lColDividerComplete := .T. //completa pintado hasta el footer cuando lineas no llenan todo el browse
:lFastEdit := .T.
:SetColor( CLR_BLACK, RGB(221,245,255) )
END WITH
oBrw:SetArray( aTblItem )
oBrw:CreateFromCode()
oPanelCue:oClient := oBrw
WITH OBJECT oBrw
:bChange := { || oBrw:Refresh() }
:nTop := 0
:nLeft := 0
:nWidth := nAnchoPan
:nHeight := nAltoPan-320
:aCols[1]:bStrData := {||If( Len( oBrw:aArrayData ) > 0, oBrw:aArrayData[ oBrw:nArrayAt, 1 ], "" )}
:aCols[2]:bStrData := {||If( Len( oBrw:aArrayData ) > 0, oBrw:aArrayData[ oBrw:nArrayAt, 2 ], "" )}
:aCols[3]:bStrData := {||If( Len( oBrw:aArrayData ) > 0, oBrw:aArrayData[ oBrw:nArrayAt, 3 ], "" )}
:aCols[4]:bStrData := {||If( Len( oBrw:aArrayData ) > 0, oBrw:aArrayData[ oBrw:nArrayAt, 4 ], "" )}
:aCols[5]:bStrData := {||If( Len( oBrw:aArrayData ) > 0, aUnidadMedida[oBrw:aArrayData[ oBrw:nArrayAt, 5 ]], 0 )}
:aCols[6]:bStrData := {||If( oBrw:aArrayData[ oBrw:nArrayAt, 6 ] <> 0, oBrw:aArrayData[ oBrw:nArrayAt, 6 ], 0 )}
:aCols[7]:bStrData := {||If( oBrw:aArrayData[ oBrw:nArrayAt, 6 ] <> 0, oBrw:aArrayData[ oBrw:nArrayAt, 4 ]/oBrw:aArrayData[ oBrw:nArrayAt, 6 ], 0 )}
:bKeyDown := { |nKey| ( IF(nKey==VK_INSERT,(InsertaItems(oWndChild,oBrw,@aTblItem,lCpteNew),oBrw:SetArray(aTblItem)),;
IF(nKey==VK_DELETE,EliminaItems(oBrw,lCpteNew),)),;
oBrw:SetFocus() ) }
END
*----------------------------------------------------------
hLays["H4"]:aVLayout[1]:oClient := oPanelCue
****************************************************************************
*
FUNCTION InsertaItems(oWndChild,oBrw,aTblItem,lCpteNew)
LOCAL hArt := Hash()
IF !lCpteNew
RETURN NIL
ENDIF
BuscarArticulos(oWndChild,@hArt)
IF EMPTY(hArt["cNomArt"])
RETURN NIL
ENDIF
AAdd( aTblItem, { LEN(aTblItem)+1,; // 1-
hArt["cCodigo"],; // 2-
hArt["cNomArt"],; // 3-Nombre del Articulo
1,; // 4-Cantidad
hArt["nUniMed"],; // 5-
hArt["KgBolsa"],; // 6-
1/hArt["KgBolsa"],; // 7-
"COMUN",; // 8-Tipo de Remito
hArt["IdArticulo"],; // 9-Id_Articulo
hArt["IdRubro"],; // 10-IdRubro
hArt["IdSubRubro"],; // 11-IdSubRubro
"" } )
oBrw:Refresh()
RETURN NIL
*
****************************************************************************
Saludos
Marcelo