[Gambas-user] Printing

Benoit Minisini gambas at ...2...
Wed May 21 23:44:29 CEST 2003


Le Mercredi 21 Mai 2003 16:11, Ken Schrock a écrit :
> On Tuesday 20 May 2003 3:15 am, Benoit Minisini wrote:
> > Le Lundi 19 Mai 2003 06:52, Ken Schrock a écrit :
> > > I see reading properties, doing new page, showing setup dialog
> > > But I don't see a way to get a handle or printer object
> > > How does one actually print (printer-graphically)?
> >
> > Draw.Begin(Printer)
> >
> > Draw.Rect(...)
> > Draw.Text(...)
> > ...
> >
> > Printer.NewPage
> >
> > Draw...
> >
> > Draw.End(Printer)
> >
> > I tested it once a long time ago. So tell me if you have problems, bugs,
> > strange behaviour with the Printer class.
>
> Well, it is a little strange...
> I started with a test on a form
>
>   DIM mypic AS Picture
>   mypic = NEW Picture
>   mypic.load("/root/Projects/testdraw/gambas.gif")
>   Draw.begin(ME)
>   Draw.rect(100, 100, 200, 200)
>   Draw.line(120,120,280,280)
>   Draw.picture(mypic)
>   Draw.end()
>
> And that works fine
> If I then simply do
>
> Draw.Begin(Printer)
>
> It says "Unknown identifier: Printer..." during syntax check
> If I then try
>
> DIM foobar AS Printer
> Draw.Begin(foobar)
>
> It says "Null Object" at runtime
> However, if I do
>
> DIM foobar AS Printer
> Draw.Begin(Printer)
>
> It then works ???

In fact, it is not a bug, it is a compiler feature :-)

The compiler assumes that the identifier MyClass is a class only if it finds:

  something AS MyClass

Or

  CLASS MyClass

Before the real use of the class.

So you must add CLASS Printer at the beginning of your code.

This behaviour may hopefully change in the future :-)


> However, it cuts about 35 pixels off the top

Could you send me your project so that I see what you mean ?

>
> Also, is there a way to grab the entire Form client area
> (Or the entire window for that matter) and print it?

No way at the moment.

>
> > Regards,

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list