Printing - How to?

new topic     » topic index » view thread      » older message » newer message

Hi all,
I am trying to create a print procedure for my program, following is my 
code but it all prints on one line. How do I send line feeds. Or am i 
doing something else wrong.
Also
How can i tell if the text is too long for a line?
How would i know when to start a new page?
 
procedure HistoryPrintButton_onClick ()
sequence result, itemselected, text, HistoryKey, HistoryData, cur
atom i, qtyrecords
cur = { 13, 10 }
i=1
result = getPrinter()
if length(result) then
    if not startDoc( sprintf( "KeyTrack History Report, Cop %s", {i})) 
then
--        exit
    end if
 
    if not startPage() then
--        exit
    end if
 
    wPuts( Printer, "KeyTrack V1.0 History Report for " & 
getText(HistoryItem) & cur)
 
    qtyrecords = getLVCount( HistoryList )
    for x = 1 to qtyrecords do
        itemselected= {x}
        if length( itemselected ) then  
            text = value(getLVItemText( HistoryList, itemselected[1],3)) 
 
            curRecord = text[2]  
            setText(HistoryDate, getLVItemText( HistoryList, 
itemselected[1],1)) 
            setText(HistoryTransaction, getLVItemText( HistoryList, 
itemselected[1],2)) 
            HistoryKey = db_record_key(curRecord) 
            HistoryData = db_record_data(curRecord) 
            setText(HistoryTime, sprintf("%d",HistoryKey[4]) & ":" & 
sprintf("%d",HistoryKey[5]) & ":" & sprintf("%d",HistoryKey[6])) 
            if length(HistoryData) > 1 then 
                setText(HistoryNotes, HistoryData[2]) 
            else 
                setText(HistoryNotes, "No notes on file") 
            end if 
        end if
        wPuts( Printer, "Date " & getText(HistoryDate) & "          Time 
" & getText(HistoryTime))
        wPuts( Printer, cur)  
        wPuts( Printer, "Transaction " & getText(HistoryTransaction) & 
cur)
        wPuts( Printer, "Notes " & getText(HistoryNotes) & cur)
        wPuts( Printer, 
    end for
 
    if not endPage() then
--        exit
    end if
 
    if not endDoc() then
--        exit
    end if
 
    releasePrinter()
end if
end procedure

Thanks
Tony Steward
 

Come visit me at www.locksdownunder.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu