Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Clipper Visual-Objects > Re: Printing on...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 11335 of 11703
Post > Topic >>

Re: Printing on serial ****t

by "Francescangeli F." <francescangeli.f@[EMAIL PROTECTED] > Apr 22, 2008 at 12:24 PM

Hi Danijel,

the easiest way:
-----------------------------------------------------------------------------
LOCAL siHandle AS PTR
    siHandle := FOpen("LPT2.DOS",FO_WRITE)
    FWriteLine(siHandle,"Whatever you want")
    FClose(siHandle)

-----------------------------------------------------------------------------

 Slightly sophisticated:  8-))
-----------------------------------------------------------------------------
LOCAL siHandle AS PTR
LOCAL oPrint AS StampaRTF
LOCAL crlf AS STRING
LOCAL oPrinter AS PrintingDevice
 crlf := _chr(13)+_chr(10)
 oDCRichEdit1:TextValue := PadC("Anagrafica Socio 
"+AllTrim(SELF:Server:Nome),78)+crlf
 oDCRichEdit1:TextValue += "Whatever else"+crlf
 oDCRichEdit1:ReadOnly := TRUE
 siHandle := FCreate("TEMP.TXT")
 FWriteLine(siHandle,oDCRichEdit1:TextValue)
* FWriteLine(siHandle, CHR(12))
 FClose(siHandle)
 oPrinter := PrintingDevice{}
 oPrinter:Setup()
 oPrint := StampaRTF{"Stampa Anagrafica Socio",oPrinter}
 IF !oPrint:IsValid()
  TextBox{SELF,"WARNING","Printer not ready !"}:Show()
  oPrint:Destroy()
 ELSE
  oFont := Font{FONTROMAN12}
  oPrint:Font := oFont
  oPrint:Font:PitchFixed := TRUE
  oPrint:Start()
  oPrint:Destroy()
 ENDIF
 FErase("TEMP.TXT")

GLOBAL position AS LONGINT
GLOBAL alreadyopen AS LOGIC

CLASS StampaRTF INHERIT Printer
 EX****T oPrintOwner AS VideoRTF

METHOD Init(cJobName, oPrintingDevice) CLASS StampaRTF
 SUPER:Init(cJobName, oPrintingDevice)
RETURN SELF

METHOD PrinterExpose(OPEE) CLASS StampaRTF
LOCAL xpos AS INT
LOCAL ypos AS INT
LOCAL nHeight AS INT
LOCAL nCur_Y_pos AS INT
LOCAL oTextSize AS OBJECT
LOCAL oCanvas AS OBJECT
LOCAL siHandle AS PTR
LOCAL cBuffer AS STRING

siHandle := FOpen("temp.txt",FO_READ)
IF !alreadyopen
 position := FSeek(siHandle,0)
 alreadyopen := TRUE
ELSE
 position := FSeek(siHandle,position)
ENDIF
xpos := 5
ypos := 0
oCanvas := SELF:CanvasArea
nCur_Y_pos := oCanvas:Height
DO WHILE !FEof(siHandle)
 cBuffer := FReadLine(siHandle)
 position := FSeek(siHandle,0,FS_RELATIVE)
 IF (CHR(12) $ cbuffer)
  FClose(siHandle)
  RETURN TRUE
 ELSE
  oTextSize   := SELF:SizeText(cBuffer)
  nHeight     := (oTextSize:Height + 2)
  ypos        := nCur_Y_pos - nHeight
  SELF:TextPrint(cBuffer, point{xpos, ypos})
  nCur_Y_pos  := ypos
  IF nCur_Y_pos <= 0
   FClose(siHandle)
   RETURN TRUE
  ENDIF
 ENDIF
ENDDO
FClose(siHandle)
alreadyopen := FALSE

RETURN FALSE   // Nothing more to print

-----------------------------------------------------------------------------

HTH,
    Francesco

<danijel.koprivnjak@[EMAIL PROTECTED]
> ha scritto nel messaggio 
news:e84820e0-0f50-4f81-bc26-d558fe01c7cc@[EMAIL PROTECTED]
> Hi !
>
> does anybody know how I can put text on serial printer from my app.
> When  use FCOPY() I get strange characters like upside down query.
>
> thx
> Danijel Koprivnjak
 




 4 Posts in Topic:
Printing on serial port
danijel.koprivnjak@[EMAIL  2008-04-22 02:40:32 
Re: Printing on serial port
"Francescangeli F.&q  2008-04-22 12:24:08 
Re: Printing on serial port
"Francescangeli F.&q  2008-04-22 12:30:49 
Re: Printing on serial port
Tony Holland <tony.hol  2008-04-22 04:01:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 21:15:53 CDT 2008.