by Jairo Centeno » Wed Mar 14, 2007 3:55 pm
Hola JoseLuis,
Incluye la linea #xtranslate LL_PROJECT_LIST => 2, o bien, utiliza directamente el valor.
En "C:\Archivos de programa\combit\LL12\Programmable Samples and Declarations\Alaska Xbase++" se encuentra cmbtll12.ch
#include "FiveWin.ch"
#include "cmbtll12.ch"
Global oActiveX, oWnd, hJob, nRet
Function Main()
Local cEvents := ""
LOCAL aField, aType, aLen, aDec, sName
LOCAL FldType, FldContent, DateBuffer, lExpr, I:=1, bAsField:=.T.
USE ARTICLE NEW
GO TOP
aField := Array( ARTICLE->(FCount()) )
aType := Array( ARTICLE->(FCount()) )
aLen := Array( ARTICLE->(FCount()) )
aDec := Array( ARTICLE->(FCount()) )
sname := "article.lst"
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
oActiveX = TActiveX():New( oWnd, "L12.List-Label12_Ctrl_32.1" )
oWnd:oClient = oActiveX // To fill the entire window surface
//US: Read field info from database
AFields( aField, aType, aLen, aDec )
//US: open List & Label job, retrieve job handle
hJob := 1
//US: Enable multiple table lines
oActiveX:Do( "LlSetOption", LL_OPTION_MULTIPLETABLELINES, 1)
//US: clear DLL-internal field buffer
oActiveX:Do( "LlDefineFieldStart" )
// US: Define Fields
FOR I = 1 to ARTICLE->(Fcount())
DateBuffer = Replicate(chr(0), 255)
DO CASE
CASE aType[i] == "N"
FldType=LL_NUMERIC
FldContent=Str( FieldGet(i) )
CASE aType[i] == "D"
FldType=LL_DATE
//US: Convert to Julian Date
//US: Create function tree
lExpr = oActiveX:Do("LlExprParse", "CTOD( FieldGet(i) )", .F. )
//US: Evaluate expression
oActiveX:Do("LlExprEvaluate", lExpr, @DateBuffer )
//US: Free expression
oActiveX:Do("LlExprFree", lExpr )
FldContent = DateBuffer
CASE aType[i] == "L"
FldType=LL_BOOLEAN
if FieldGet(i) = .F.
FldContent="FALSE"
else
FldContent="TRUE" endif
CASE aType[i] == "C"
FldType=LL_TEXT
FldContent=Trim(FieldGet(i))
// US: for article number generate EAN128-barcode
if i=1
DO CASE
// US: Distinguish between field and variable declaration
CASE bAsField==.F.
oActiveX:Do("LlDefineVariableExt", "ARTICLENO_EAN128", Trim(FieldGet(i)), LL_BARCODE_EAN128 )
CASE bAsField==.T.
oActiveX:Do("LlDefineFieldExt", "ARTICLENO_EAN128", Trim(FieldGet(i)), LL_BARCODE_EAN128 )
END CASE
endif
CASE aType[i] == "M"
FldType=LL_TEXT
FldContent=FieldGet(i)
END CASE
//US: pass data to List & Label
DO CASE
CASE bAsField==.F.
oActiveX:Do("LlDefineVariableExt", aField[i], FldContent, FldType )
CASE bAsField==.T.
oActiveX:Do("LlDefineFieldExt",aField[i], FldContent, FldType )
END CASE
NEXT I
// US: start designer
oActiveX:Do("LlSetPrinterDefaultsDir",hJob,"C:\Windows\Temp")
oActiveX:Do("LlDefineLayout",oWnd:hWnd,"Designer",LL_PROJECT_LIST, "article.lst")
ACTIVATE WINDOW oWnd VALID ( dbCloseArea(),.t. )
Return