[Gambas-user] Working printsample with more than one page
Rolf-Werner Eilert
eilert-sprachen at ...221...
Wed Feb 3 16:59:45 CET 2016
What I meant is the Return command. Sorry, somewhat unfocused...
Somewhere you start, e. g. in a Sub Start (). There you collect your
data and stuff and build the printer object, e. g. myPrinter.
Then you say myPrinter.Print which will jump to Sub myPrinter_Begin().
Now you have everything running except the actual printing. But you can
already measure how long your table will be and so on. When you know how
many pages will result, you say myPrinter.Count =
numberOfPagesToBePrinted and it will automagically jump into Sub
myPrinter_Draw() as many times as pages are needed.
While printing, if you want to end the page, within myPrinter_Draw(),
you can say
Return
when you want to stop before the codes ends anyway to stop this page.
But I don't need this anymore, as my new code will stop painting the
table at the right line anyway. Then printing is ready for this page,
and myPrinter_Draw() will end itself.
Regards
Rolf
Am 03.02.2016 16:22, schrieb Roel Touwen:
> Hi Rolf,
>
> Sounds easy, but (maybe a stupid question) but where do I send the return?
>
> Grtz
>
> Roel
>
>
>
> op 03-02-16 16:19, Rolf-Werner Eilert schreef:
>> Basically, I think that is easy here: Just send a Return when the "last"
>> row has been reached, and it will leave the printing and start a new page.
>>
>> Still, you have to define the number of page to be printed in order to
>> be able to start printing.
>>
>> That makes it somewhat... errr.... ;)
>>
>> Rolf
>>
>> Am 03.02.2016 16:05, schrieb Roel Touwen:
>>> Hi Rolf,
>>>
>>> In my software I print invoice, lists, whatever..... When I print
>>> invoices I print the lines with a function which calculates where it has
>>> to print on the page:
>>>
>>> Public Sub PrintAt(Row As Float, Col As Integer, Txt As String)
>>>
>>> txtWidth = Draw.Font.TextWidth(txt)
>>> txtHeight = Draw.Font.TextHeight(txt)
>>> PosY = Row * 162
>>> posX = Col * 55 + 50
>>> Paint.DrawRichText(Txt, PosX, PosY, txtWidth, txtHeight)
>>>
>>> End
>>>
>>> Now I want to skip to the next page when variable Row exceeds a value.
>>> But somehow I cannot find how I can skip to the next page. So what I am
>>> realy looking for is the addpage function which was available in gambas 2.
>>> Whe I fiddled arount in my code by telling there were 2 pages, the
>>> content on page 2 was nog cleared, e.g. it was the same as on page 1.
>>>
>>> Any ideas?
>>>
>>> Grtz
>>>
>>> Roel Touwen
>>>
>>>
>>>
>>> op 03-02-16 15:57, Rolf-Werner Eilert schreef:
>>>> Hi Roel,
>>>>
>>>> The way printing is managed in Gambas3 is completely different in one
>>>> way: You have to tell the number of pages beforehand, then printing runs
>>>> automatically page for page. There is one help page that gives a rough
>>>> overview.
>>>>
>>>> Why do you want to clear a page? Your code will have to check what to
>>>> print on each page while it is printing, and you cannot stop until all
>>>> pages have been printed.
>>>>
>>>> In my case, the problem was how to print tables of random length.
>>>> Gambas2 was "simple": The program just printed a table line for line,
>>>> then initiated a new page when the table had reached the lower edge.
>>>>
>>>> Now I found this solution for Gambas3: The table will start at a given
>>>> position on the page. There are functions that I could use to measure
>>>> the exact height of each table line. It sums up until it finds it will
>>>> hit the lower end, then save the number of this line in a list, go on to
>>>> the next end of page and so on... After measuring and counting, the
>>>> number of entries in the list will tell how many pages are needed, and
>>>> printing can be started.
>>>>
>>>> I found that the new way of printing is way faster than the old one. It
>>>> is in fact so fast that I could simply print into a temporary pdf file,
>>>> then use this file for a preview. When the user hits OK, this pdf is
>>>> sent to the printer.
>>>>
>>>> On the other hand, I had to re-think a number of functions and when this
>>>> will happen before that etc., and still haven't completely finished :)
>>>>
>>>> Regards
>>>> Rolf
>>>>
>>>> Am 03.02.2016 12:03, schrieb Roel Touwen:
>>>>> Hi all,
>>>>>
>>>>> I'm converting software from Gambas 2 to 3. Printing seems to be very
>>>>> very different in Gambas 3.
>>>>>
>>>>> Has anyone a sample of printing more pages? So also clearing the page etc.
>>>>>
>>>>> Thanks for now.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Roel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>>> Monitor end-to-end web transactions and take corrective actions now
>>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>>> _______________________________________________
>>>>> Gambas-user mailing list
>>>>> Gambas-user at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>
>>>> ------------------------------------------------------------------------------
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>> _______________________________________________
>>>> Gambas-user mailing list
>>>> Gambas-user at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> ------------------------------------------------------------------------------
>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>> Monitor end-to-end web transactions and take corrective actions now
>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>> _______________________________________________
>>> Gambas-user mailing list
>>> Gambas-user at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> 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