[Gambas-user] Yet another simple printing question !

Vasilis Kanatas vkanatas13 at ...626...
Fri Mar 21 16:57:21 CET 2014


Thanks Tobi,

I tried to find a solution in order to print Labels that I placed into a
ScrollArea.
It is obvious that it only prints the background of the ScrollArea and not
the Labels or Buttons or anything other  that I put there in design time.

So the problem remains!
How can I place data on a form (or any container of this form) and then
print them as I see them?
Actually I only want to place text in Labels and then get a print (a
receipt)






On Fri, Mar 21, 2014 at 1:42 PM, Tobias Boege <taboege at ...626...> wrote:

> On Thu, 20 Mar 2014, Vasilis Kanatas wrote:
> > Thanks Rolf-Werner,
> >
> > I tried
> > Private $hImage As New Image
> > and had the same result ! Printing white page!
> >
> > What I want is to print the labels of a form or ScrollArea!!
> >
> > I also tried to change the *Printing Example of Gambas 3* to make it work
> > for my issue. Here's what I did (3 steps):
> >
> > 1......I've changed Form_load as following to Grab the contents of
> > srcImage.ScrollArea:
> >
> > Public Sub Form_Open()
> >
> >   Me.Center
> >
> >   txtText.Text = File.Load("molly-malone.txt")
> >   txtFontText.Text = Font["17"].ToString()
> >   Try $hImage = scrImage.Grab
> >  ' $hImage = New Image(scrImage.Width, scrImage.Height)
> >
> >   'scrImage.ResizeContents($hImage.W, $hImage.H)
> >   'scrImage.Refresh
> >
> > End
> >
>
> OK, you come immediately from Gambas 2, right? Control.Grab() worked
> completely differently in Gambas 2. It took a screenshot of the control,
> as you know.
>
> In Gambas 3 it grabs the mouse and keyboard of the program, so that all
> mouse and keyboard events produced are raised under that control's event
> name. Look it up in the documentation[0].
>
> So no wonder that your page remains empty, as the image you are painting
> is also empty. You noticed that there was some problem with Grab(), right?
> You use Try on the Grab() line because it would otherwise raise an error.
> That's an indication to look at the documentation, especially if you use a
> new major version the first time :-)
>
> Regards,
> Tobi
>
> [0] http://gambaswiki.org/wiki/comp/gb.qt4/control/grab
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list