I would like to give a new life to a very old application that was written in foxplus (a xbase dialect) in 1990 :)
At that time, the display was 80 char per line and the printer was 132 char per line, so data was printed using the logics you will find at the bottom of this message. I wonder if I can still use the old code somehow. My idea is: 1. I get the printer PageWidth in pixel PageWidth:=Printer.PageWidth; 2. I get the printer PageHeight in pixel PageHeight:=Printer.PageHeight; 3. I get the height of a line LineHeight:=Printer.Canvas.TextHeight('M')+5; // I add a few pixels to prevent text lines to overlap; 4. I get the number of rows in a page MaxLinesNo:=PageHeight div LineHeight 5. now lets translate line @7,87 SAY "CITTA' PARTITA IVA" "7" --> translates into yPos:=LineHeight*7 "87" --> translates into xPos:= round (87/132*PageWidth); so I write Printer.Canvas.Textout(XPos, YPos, 'CITTA' PARTITA IVA'); 6. how do I set the size of the font? I am expecting not less than 56 lines in a page, so I shrink the font size until I get LineHeight <=Printer.PageHeight div 60 7. I am surely missing something. Any help? Thank you Peppe SET DEVI TO PRIN EJECT GO TOP TIT=.T. DO WHIL .NOT. EOF() * if current row >=max, jump to the new page and print header IF PROW()>=56 TIT=.T. EJECT ENDI IF TIT * print header @1,2 SAY "_______________________________________________________" @1,57 SAY "_______________________________________________________" @1,112 SAY "____________________" @2,1 SAY "|" @2,132 SAY "|" @3,1 SAY "| "+AZIENDA IF TA="C" @3,58 SAY "LISTATO CLIENTI ALLA DATA ; "+DTOC(DATE()) ELSE @3,58 SAY "LISTATO FORNITORI ALLA DATA ; "+DTOC(DATE()) ENDI @3,132 SAY "|" @4,1 SAY "|" @4,132 SAY "|" @5,1 SAY "|______________________________________________________" @5,56 SAY "_______________________________________________________" @5,111 SAY "_____________________|" @7,2 SAY "CODICE RAGIONE SOCIALE SEDE ; LEG." @7,87 SAY "CITTA' PARTITA IVA" @8,79 TIT=.F. ENDI * end print header @PROW()+1,1 SAY SUBS(COD_CL,1,2)+"."+SUBS(COD_CL,3,2)+"."+SUBS(COD_CL,; 5,5) @PROW(),16 SAY DES_CL @PROW(),48 SAY SEDE_LEG @PROW(),80 SAY CAP_CITTA @PROW(),112 SAY PART_IVA SKIP ENDD @PROW()+1,1 SAY " " SET DEVI TO SCRE RETU -- _______________________________________________ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus