paint.end

Post your Gambas programming questions here.
Post Reply
User avatar
sadams54
Posts: 139
Joined: Monday 9th July 2018 3:43am
Contact:

paint.end

Post by sadams54 »

With the latest update many things changed and no backward compatibility was considered. I have fixed my printing problems with the help of benoit, but one remains.
In the past it worked fine. I set the number of pages for the document in the begin method. The it called the draw as many times as there are pages. each time you end the page with a paint.end command. Problem is now this works for a single page no issue. It crashes on subsequent pages with the error "No current device" on the first command to try to use the paint object. Something has changed. What is the new method to end a page and start the next?
User avatar
grayghost4
Posts: 174
Joined: Wednesday 5th December 2018 5:00am
Location: Marengo, Illinois usa

Re: paint.end

Post by grayghost4 »

give this a try , it should print three pages :
Public Sub PrintButton_Click()
  
  If Printer2.Configure() Then Return
  Printer2.Count = 3
  Me.Enabled = False
  Inc Application.Busy
  Printer2.Print
  Dec Application.Busy
  Me.Enabled = True
End


Public Sub Printer2_Draw()
 Paint.DrawRichText("hello", 300, 300)
 Paint.DrawRichText("page # " & Printer2.page, 400, 600)
End 
User avatar
sadams54
Posts: 139
Joined: Monday 9th July 2018 3:43am
Contact:

Re: paint.end

Post by sadams54 »

Hey, thanks so much. Your answer was a bit wordy but that did the trick.

You could simplify the answer for others by just saying to eliminate the paint.end command and it all works.

Looks like the paint.end command is no longer needed.

Thanks again for the help.
Post Reply