[Gambas-user] Anybody have an example using DCOP?
johnf
jfabiani at ...1109...
Wed Jan 11 03:56:11 CET 2006
On Tuesday 10 January 2006 17:31, Rob Kudla wrote:
> On Tue January 10 2006 15:55, johnf wrote:
> > edit) the xml file. I wonder if it would be possible to store
> > the xml in the database? I would think I could using a text
> > field to get that done.
>
> Yeah, that's exactly what I've done in the past.
>
> > But I also like the idea of using the Draw class. Do you have
> > an example of creating a report and then printing. It does
>
> Well, here's a minimal example.... pseudo-code since I don't have
> Gambas on the machine I'm writing this on....
>
> public PrintYPos as integer
> public RecCount as integer
>
> public sub PrintReport(r as Result)
> if r.eof then return
> Draw.Begin(Printer)
> PrintHeader
> printypos = 100
> do while not r.eof
> inc RecCount
> PrintRow(r)
> loop
> PrintFooter
> Draw.End
> end
>
> public sub PrintHeader
> Draw.Font.Size = 18
> Draw.Font.Bold = True
> Draw.Text("This is my report",10,10)
> end
>
> public sub PrintRow(r as Result)
> Draw.Font.Size = 10
> Draw.Font.Bold = False
> Draw.Text(r["Name"], 100, PrintYPos)
> Draw.Text(r["Address"], 300, PrintYPos)
> Draw.Text(r["Phone"], 500, PrintYPos)
> PrintYPos = PrintYPos + 15
> if PrintYPos > (Printer.Height - 30) then
> Printer.NewPage
> ' if we had a page header we'd reprint it here
> PrintYPos = 100
> endif
> end
>
> public sub PrintFooter
> Draw.Font.Size = 18
> Draw.Font.Bold = True
> Draw.Text("Number of records printed: " &
> RecCount,10,printer.height - 30)
> end
>
> Rob
I think the draw class appears the better way to go. thanks for the code...
John
More information about the User
mailing list