by EASYSOFT » Fri Feb 10, 2006 12:16 pm
Es el código
// Reviewing arrays - using FiveWin TCBrowse
#include "FiveWin.ch"
#include "TCBrowse.ch"
//----------------------------------------------------------------------------//
static oBrw
//----------------------------------------------------------------------------//
Function factura(oWnd)
memvar inbod
local nI, aTestData, uVar, oBtn, oFont
local oWndChild, odfactu, oBar, oMsg
local cName := "Testing..."
local canum
CursorWait()
// load some fields into a multi element array,
dbselectarea("kardex")
canum := ' 74'
if !dbseek(inbod+'S'+canum)
?? inbod+'S'+canum
endif
aTestData := array(5,4) // Array( LastRec(), 4 ) // make the array
nI = 1
do while !eof() .and. inbod+'S'+canum = in_bod+in_tran+in_num
aTestData[nI,1] := PADR(Field->in_cod) // numb
dbselectarea("bodega")
if dbseek('01'+aTestData[nI,1])
descri := in_dsc
endif
dbselectarea("kardex")
aTestData[nI,2] := Trim(descri)
// need to pad char array element for editing beyond last character
aTestData[nI,3] := Field->in_klsomts // logical
aTestData[nI,4] := Field->in_vlrtota // date
ni++
dbskip()
enddo
* USE
* Aadd( atestdata, {"","","",0} )
DEFINE DIALOG odfactu FROM 2,2 TO 24, 85 OF oWnd TITLE "Test Multi Col Array"
@ 1.5, 3 COLUMN BROWSE oBrw OF odfactu ;
SIZE 170, 145 MESSAGE "Multi-Element Array Column Browse"
oBrw:SetArray( aTestData )
oBrw:Refresh()
oBrw:lHitBottom:= .f.
* oBrw:GoBottom()
SysRefresh()
oBrw:nClrForeHead := CLR_WHITE
oBrw:nClrBackHead := CLR_BLUE
// oBrw:bLDblClick = { | nRow, nCol | EditCell( oBrw, nRow, nCol ) }
// oBrw:lNoLiteBar := .t. // get rid of the lite bar cursor
// oBrw:lNoGrayBar := .t. // get rid of that ugly gray bar on lost focus
// oBrw:lMChange := .t. // set false to prevent Mouse colm resize/drag
oBrw:lLogicDrop := .t. // use crazy logic dropbox
oBrw:lNoHScroll := .t. // don't use that pesky horiz scroll bar
oBrw:nAdjColumn := 3 // expand this column to flush table right
oBrw:nFreeze := 5 // This will freeze all & prevent horiz scrolling
// NOTE can't resize/drag on frozen columns
ADD COLUMN TO BROWSE oBrw DATA oBrw:nAt ;
SIZE 30 NOBAR CENTER COLOR CLR_BLACK, CLR_HGRAY ;
HEADER "No"
ADD COLUMN TO oBrw DATA ARRAY ELEM 3 ;
HEADER "C¢digo " SIZE 60 RIGHT
* ADD TO oBrw ARRAY ELM 2 ;
* HEADER " Nombres" EDIT MESSAGE "Apellidos y Nombres" ;
* SIZE 10 PICTURE "" // size is small since will nAdjColumn width
* ADD COLUMN TO oBrw DATA ARRAY ELEM 2 ;
* HEADER "Descrupci¢n" EDIT SIZE 10 PICTURE "@S50"
* ADD COLUMN TO oBrw DATA ARRAY ELEM 3 ;
* HEADER "Cantidad " SIZE 60 RIGHT ;
* EDITABLE
ACTIVATE DIALOG odfactu
Saludos
Oscar
Saludos
Oscar
Fwh 10.4, bcc55