TLabel class
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
TLabel class
I'm trying to modify the tlabel class of Manuel Calero Solis
I have make a small class to the labels on our application, with a simply dialog where you can set the label parameters ( nheight,nWidth, Vertical separator , Horizontal separator, labels for line print grid, print shadow repeat records ) the parameters can be save on ini file
a snapshot of the dialog
It run ok but I have some problems
1. How I can to not show the last label ( or How I can add n inferior margin)
Because I have this error as you can see
I tried also with :
::oLabel:nTopMargin := 2.1
::oLabel:nDnMargin := 2.1
::oLabel:nLeftMargin := 0.1
::oLabel:nRightMargin := 0.1
while the top margin is moved the bottom margin is the same
2, How I can print labels with barcodes using barlib functions ?
I saw the Label16.prg
It print a barcode with the command : LBLITEM DATA char2Ean(cSendCode) FONT 2 CENTERED
with function of Barlib I must use to print barcodes ?
I have make a small class to the labels on our application, with a simply dialog where you can set the label parameters ( nheight,nWidth, Vertical separator , Horizontal separator, labels for line print grid, print shadow repeat records ) the parameters can be save on ini file
a snapshot of the dialog
It run ok but I have some problems
1. How I can to not show the last label ( or How I can add n inferior margin)
Because I have this error as you can see
I tried also with :
::oLabel:nTopMargin := 2.1
::oLabel:nDnMargin := 2.1
::oLabel:nLeftMargin := 0.1
::oLabel:nRightMargin := 0.1
while the top margin is moved the bottom margin is the same
2, How I can print labels with barcodes using barlib functions ?
I saw the Label16.prg
It print a barcode with the command : LBLITEM DATA char2Ean(cSendCode) FONT 2 CENTERED
with function of Barlib I must use to print barcodes ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Friends,
Please can help me
Itried to insert this new method on Label.prg
and on Label16.prg
ACTIVATE LABEL oLabel ;
ON STARTLABEL PrintBarcode( oLabel ,cSendCode)
Function PrintBarcode( oLabel ,cSendCode)
local nTop := oLabel:nRow
local nLeft := oLabel:Column()
local nBottom := oLabel:nRow + oLabel:nLblHeight
local nRight := nLeft + oLabel:nLblWidth
local ncolor := CLR_BLACK
return oLabel:Barcode(nTop , nLeft, cSendCode, nRight, nBottom, ncolor,,,,)
it not make error and not print the barcode... why ?
Please can help me
Itried to insert this new method on Label.prg
Code: Select all
METHOD Barcode(nRow, nCol, cCode, nWidth, nHeight, ncolor,lHorz,lBanner,cFont,nType,nScale) CLASS TLabel
LOCAL nPixRow, nPixCol, nPixWidth, nPixHeight
DEFAULT nRow := .2 ,;
nCol := .2 ,;
nWidth := 1 ,;
nHeight := 1 ,;
nScale := RPT_INCHES ,;
lHorz := .f.
IF nScale == RPT_CMETERS
nRow := Int(nRow/2.54)
nCol := Int(nCol/2.54)
nWidth := Int(nWidth/2.54)
nHeight := Int(nHeight/2.54)
ELSEIF nScale == RPT_MMETERS
nRow := Int(nRow/25.4)
nCol := Int(nCol/25.4)
nWidth := Int(nWidth/25.4)
nHeight := Int(nHeight/25.4)
ENDIF
nPixRow := Int(::nLogPixY*nRow)
nPixCol := Int(::nLogPixX*nCol)
nPixWidth := Int(::nLogPixX*nWidth)
nPixHeight := Int(::nLogPixY*nHeight)
Code128(nPixRow, nPixCol,cCode,::oDevice,"C",CLR_BLACK,lHorz,nPixWidth,nPixHeight)
return nil
and on Label16.prg
ACTIVATE LABEL oLabel ;
ON STARTLABEL PrintBarcode( oLabel ,cSendCode)
Function PrintBarcode( oLabel ,cSendCode)
local nTop := oLabel:nRow
local nLeft := oLabel:Column()
local nBottom := oLabel:nRow + oLabel:nLblHeight
local nRight := nLeft + oLabel:nLblWidth
local ncolor := CLR_BLACK
return oLabel:Barcode(nTop , nLeft, cSendCode, nRight, nBottom, ncolor,,,,)
it not make error and not print the barcode... why ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Perhap I found a solution
This morning the sample Label16.prg show a barcode but it is allway at the same x,y
This morning the sample Label16.prg show a barcode but it is allway at the same x,y
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Now I understood but also not run ok
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Barlib Resolved !!!
tried with Ean13 and code3_9
tried with Ean13 and code3_9
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TLabel class
very good
Please post a complete example to help other users, thanks
Please post a complete example to help other users, thanks
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Add New Method on Label Class
METHOD PrintBarcode(oRpt,nVal,nRiga,nCol,nType)
sample Label16.prg
Now run ok
Only I found error on Barlib class on these codes
// 13 = Industrial 2 of 5 check digit
// 16 = Matrix 2 of 5 ...
METHOD PrintBarcode(oRpt,nVal,nRiga,nCol,nType)
Code: Select all
METHOD PrintBarcode(cCode,nLine,nLeft,nType,nWidth,nHeigth,lBanner,lHorz,cFont,nColor) CLASS TLabel
local nRow := ::nRow +nLine
local nCol := ::Column() +nLeft
Local oPrint := ::oDevice
DEFAULT nWidth := 0.03 ,;
nHeigth := 0.6 ,;
lHorz := .t. ,;
nColor := CLR_BLACK ,;
lBanner := .f. ,;
cFont := 'arial'
// 1 = Code 39 ..
// 2 = Code 39 check digit
// 3 = Code 128 auto select
// 4 = Code 128 mode A
// 5 = Code 128 mode B
// 6 = Code 128 mode C
// 7 = EAN 8 ..
// 8 = EAN 13 ..
// 9 = UPC-A ...
// 10 = Codabar ...
// 11 = Suplemento 5 ..
// 12 = Industrial 2 of 5 ..
// 13 = Industrial 2 of 5 check digit
// 14 = Interlaved 2 of 5 ..
// 15 = Interlaved 2 of 5 check digit
// 16 = Matrix 2 of 5 ...
// 17 = Matrix 2 of 5 check digit
Do case
Case nType==1
Code3_9(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==2
Code3_9(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==3
Code128(nRow,nCol,cCode,oPrint,"",nColor,lHorz,nWidth,nHeigth)
Case nType==4
Code128(nRow,nCol,cCode,oPrint,"A",nColor,lHorz,nWidth,nHeigth)
Case nType==5
Code128(nRow,nCol,cCode,oPrint,"B",nColor,lHorz,nWidth,nHeigth)
Case nType==6
Code128(nRow,nCol,cCode,oPrint,"C",nColor,lHorz,nWidth,nHeigth)
Case nType==7
ean8(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==8
ean13(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==9
UPCA(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==10
Codabar(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth)
Case nType==11
sup5(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==12
ind25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==13
ind25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==14
int25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==15
int25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==16
mat25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==17
mat25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Endcase
Return Nil
sample Label16.prg
Code: Select all
#include "FiveWin.ch"
#include ".\include\label.ch"
#include ".\include\Barcode.ch"
//static cSendCode := "*51111+40759*"
//----------------------------------------------------------------------------//
FUNCTION label16()
local oLabel
local oPen1
local oFont1, oFont2, oFont3,oF1
USE "TEST" NEW SHARED ALIAS "TEST"
DEFINE PEN oPen1 WIDTH 2
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont2 NAME "DEMOEAN 13" SIZE 0,36
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-20 BOLD
* DEFINE FONT oF1 NAME "Code 128" SIZE 0, -50
LABEL oLabel SIZE 70, 70 ;
SEPARATORS 5, 2 ;
ON LINE 2 ;
PEN oPen1 ;
FILE "LABEL.PRN" ;
PREVIEW ;
TO FILE "LABEL.TXT" ;
CAPTION ( REPDEMO->DESCRIP );
FONT oFont1, oFont2, oFont3
LBLITEM AT 250 DATA "From :" FONT 1
LBLITEM AT 250 DATA "Antonio Linares SOFTWARE" FONT 1
LBLITEM AT 250 DATA "Urb. El Rosario. Avd. Rosario 34A" FONT 1
LBLITEM AT 250 DATA "29600 Marbella - SPAIN" FONT 1
LBLITEM AT 250 DATA "Phone/Fax: 34-5-2834830" FONT 1
LBLITEM DATA REPLICATE("-", 60) FONT 1
LBLITEM AT 250 DATA "To : " FONT 1
LBLITEM AT 250 DATA TEST->FIRST FONT 1
LBLITEM AT 250 DATA TEST->LAST FONT 1
LBLITEM AT 250 DATA TEST->STREET FONT 1
LBLITEM DATA REPLICATE("-", 60) FONT 1
LBLITEM AT 250 DATA "Send Code : " FONT 1
// LBLITEM DATA char2Ean(cSendCode) FONT 2 CENTERED
END LABEL oLabel
/*
Modificamos los margenes
*/
oLabel:Margin( 0.1, RPT_TOP, RPT_MMETERS )
oLabel:Margin( 0.1, RPT_BOTTOM, RPT_MMETERS )
/*
Modificamos los Colores
*/
oLabel:SetTxtColor(CLR_BLUE,1)
ACTIVATE LABEL oLabel ;
ON STARTLABEL oLabel:PrintBarcode( STR(TEST->SALARY),1100,200,1)
CLOSE TEST
/*
Ending
*/
oPen1:End()
oFont1:End()
oFont2:End()
oFont3:End()
RETURN NIL
//---------------------------------------------------------------------------//
Now run ok
Only I found error on Barlib class on these codes
// 13 = Industrial 2 of 5 check digit
// 16 = Matrix 2 of 5 ...
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Add new method
METHOD DrawingBox(lBoxDotted,nPenGrid) CLASS TLabel
to print Box or dotted box
sample :
ACTIVATE LABEL oLabel ;
ON STARTLABEL (oLabel:DrawingBox(.t.), oLabel:PrintBarcode( STR(TEST->SALARY),1100,200,9))
METHOD DrawingBox(lBoxDotted,nPenGrid) CLASS TLabel
to print Box or dotted box
sample :
ACTIVATE LABEL oLabel ;
ON STARTLABEL (oLabel:DrawingBox(.t.), oLabel:PrintBarcode( STR(TEST->SALARY),1100,200,9))
Code: Select all
METHOD DrawingBox(lBoxDotted,nPenGrid) CLASS TLabel
local nTop := ::nRow
local nLeft := ::Column()
local nBottom := ::nRow + ::nLblHeight
local nRight := nLeft + ::nLblWidth
local aPen[2]
Local oPrint := ::oDevice
DEFAULT nPenGrid := 1
DEFINE PEN aPen[1] WIDTH nPenGrid
DEFINE PEN aPen[2] STYLE PS_DOT WIDTH nPenGrid COLOR CLR_HGRAY //LINEE GUIDA
IF lBoxDotted
oPrint:Box( nTop, nLeft, nBottom, nRight, aPen[2] )
else
oPrint:Box( nTop, nLeft, nBottom, nRight,aPen[1] )
Endif
RETURN NIL
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
for the first problem
1. How I can to not show the last label ( or How I can add n inferior margin)
Because I have this error as you can see :
I try to insert this method :
METHOD NeedNewPage() INLINE ( ::nRow >= ::nBottomRow )
and modify the method METHOD EndLine(nHeight, nItem,lAuto)
the problem not is resolved
Someone can help me ?
1. How I can to not show the last label ( or How I can add n inferior margin)
Because I have this error as you can see :
I try to insert this method :
METHOD NeedNewPage() INLINE ( ::nRow >= ::nBottomRow )
and modify the method METHOD EndLine(nHeight, nItem,lAuto)
Code: Select all
METHOD EndLine(nHeight, nItem,lAuto) CLASS TLabel
STATIC lRunning := .F.
DEFAULT nHeight := ::nStdLineHeight
DEFAULT lAuto := .F.
/*
Guardamos el valor del campo procesado por si algien lo
quiere usar, puede ser interesante
*/
::nItemNow := nItem
IF ::bEndLine != nil .AND. !lRunning
lRunning := .T.
Eval( ::bEndLine)
lRunning := .F.
ENDIF
/*
Avance de una linea
*/
::nRow += nHeight
::lFirstRow := .F.
if ::NeedNewPage()
if lAuto
::EndPage()
::StartPage()
else
::EndPage()
endif
endif
RETURN nil
Someone can help me ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Any solution Pls ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: TLabel class
Code: Select all
nColLabel:= ::oSQLLabels:num_columnas
nRowLabel:= ::oSQLLabels:num_reglones
nAltoLabel:= ::oSQLLabels:tam_alto
nAnchoLabel:= ::oSQLLabels:tam_ancho
nMargenIzq:= ::oSQLLabels:mar_izquierdo
nMargenSup:= ::oSQLLabels:mar_superior
nSepVertical := ::oSQLLabels:sep_vertical
nSepHorizontal:= ::oSQLLabels:sep_horizontal
nCols:= 1
nRows:= 1
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nTopLabel + nAltoLabel
nRightLabel := nLeftLabel + nAnchoLabel
WaitOn("Generando codigos de barra... por favor espere un momento", "PRINTER_48" )
IF !Empty(AllTrim( ::aTallas[1,1]) )
IF Len( ::aTallas ) > 0
cSQLQuery:= "SELECT precio"+AppData:cPrecioVenta + ;
" FROM articulos WHERE id_item='" + AllTrim(::cCodeBarItem) + "'"
nPrecioVenta:= AppData:oMySqlDSMain:QueryValue(cSQLQuery)
cSQLQuery:= "SELECT nombre FROM articulos WHERE id_item='" + AllTrim(::cCodeBarItem) + "'"
cNombreItems:= AppData:oMySqlDSMain:QueryValue(cSQLQuery)
IF nPrecioVenta == NIL
nPrecioVenta := 0
ENDIF
IF ::nNumLabels > 1
nCols:= 1
nRows:= 1
FOR nCantidad:= 1 TO ::nNumLabels-1
IF nCols > nColLabel
nCols:= 1
nLeftLabel := nMargenIzq
nRightLabel := nLeftLabel + nAnchoLabel
nTopLabel := nTopLabel + nAltoLabel + nSepHorizontal
nBottomLabel:= nTopLabel + nAltoLabel
++nRows
ENDIF
nLeftLabel := nLeftLabel + nAnchoLabel + nSepVertical
nRightLabel:= nLeftLabel + nAnchoLabel
++nCols
NEXT
ENDIF
nCuantas:= Len( ::aTallas )
FOR nLabel:= 1 TO nCuantas
nHowLabels:= ::aTallas[nLabel,2]
FOR nCantidad:= 1 TO nHowLabels
IF nCols > nColLabel
nCols:= 1
nLeftLabel := nMargenIzq
nRightLabel := nLeftLabel + nAnchoLabel
nTopLabel := nTopLabel + nAltoLabel + nSepHorizontal
nBottomLabel:= nTopLabel + nAltoLabel
++nRows
ENDIF
IF nRows > nRowLabel
nRows:= 1
nCols:= 1
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nAltoLabel
nRightLabel := nAnchoLabel
nAltoLabel:= ::oSQLLabels:tam_alto
nAnchoLabel:= ::oSQLLabels:tam_ancho
nMargenIzq:= ::oSQLLabels:mar_izquierdo
nMargenSup:= ::oSQLLabels:mar_superior
nSepVertical := ::oSQLLabels:sep_vertical
nSepHorizontal:= ::oSQLLabels:sep_horizontal
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nTopLabel + nAltoLabel
nRightLabel := nLeftLabel + nAnchoLabel
Printer:EndPage()
Printer:StartPage()
ENDIF
// Clas TImprime de Rafa Carmona (The Full)
//MsgStop( Str(nTopLabel)+Str(nLeftLabel)+Str(nBottomLabel)+Str(nRightLabel) )
::Box( nTopLabel*10, nLeftLabel*10, nBottomLabel*10, nRightLabel*10 )
IMPRIME nTopLabel*10+(3.5/10), nLeftLabel*10+(2/10) SAY Left(cNombreItems,28) FONT ::oArial10
IMPRIME nBottomLabel*10-(6.5/10), nRightLabel*10-(18/10) SAY Transform(nPrecioVenta,'@R $ 99,999.99') FONT ::oArial10
IMPRIME nBottomLabel*10-(6.5/10), nLeftLabel*10+(4/10) SAY ::cCodeBarItem+"-"+AllTrim( ::aTallas[nLabel,1]) FONT ::oArial10
IMPRIME (nTopLabel*10)+(8/10), (nLeftLabel*10)+(2/10) CODE128 ::cCodeBarItem+"-"+AllTrim( ::aTallas[nLabel,1]) MODE "B" WIDTH 0.023 SIZE 1
nLeftLabel := nLeftLabel + nAnchoLabel + nSepVertical
nRightLabel:= nLeftLabel + nAnchoLabel
++nCols
NEXT
NEXT
ENDIF
ENDIF
WaitOff()
Re: TLabel class
Yes you are right. It is easy with EasyReport.Dear Otto,
Can I create and print Labels with EasyReport ?
Have you a sample to try ?
thanks
--
Falconi Silvio
Best regards,
Otto
Code: Select all
EASYREPORT oVRD NAME ".\xVrd\etikette.vrd"
select etikette
go top
while ! EoF()
PRINTAREA 1 OF oVrd ;
ITEMIDS { 101,102,103, ... } ;
ITEMVALUES { etikette->Name,;
etikette->VorName, ;
etikette->ort, ... }
IF oVRD:nNextRow > oVRD:nPageBreak
PAGEBREAK oVRD
ENDIF
select etikette
SKIP
enddo
oVRD:End()
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
Otto,
Itried to recompile the ER but Inot Know How make it I have some error
it Seem changed from Cristobal Navarro or others it is not the original ER of timm
I have also a oldest 16 bit releaser with license but I cannot use it on 64bit
I must recompile ER on win7
Can you help me to recompile it ?
thanks
Itried to recompile the ER but Inot Know How make it I have some error
it Seem changed from Cristobal Navarro or others it is not the original ER of timm
I have also a oldest 16 bit releaser with license but I cannot use it on 64bit
I must recompile ER on win7
Can you help me to recompile it ?
thanks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TLabel class
Silvio,
What errors do you get ?
What errors do you get ?
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TLabel class
I downloaf it from https://bitbucket.org/fivetech/easyreport/downloads
Isaw there is a xhp file for xmate
and with xmate I tried to compile it
Seem need other files and I cannot compile it
wich are the files I need to compile it with the last fwh ?
thanks
Isaw there is a xhp file for xmate
and with xmate I tried to compile it
Seem need other files and I cannot compile it
wich are the files I need to compile it with the last fwh ?
thanks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC