I have a group of components that I want to print with a button. If I use the table.print() function it prints the whole table even though the table has a scroll bar on the screen. If I use the same method but use it to print the group, it prints the table exactly as it shows on the screen, with the scroll bar and missing information. I want tot print all components with the full table also. Any solution to this, or will I have to explore another method for doing what I want?
I haven’t used this yet but I think it should work: system.print.createPrintJob()
Use i with the root container and you should be good.
Nope, same thing. The table is still incomplete
Ah oops, I misunderstood your request, read it as the exact opposite. I think what you’re asking for will be tricky, because printing the full table WITH the other components is going to have to consider that the table will need to be resized to fit all information. Then you get into issues with where components will be moved to on the fly.
Just tested this and I think it’ll work for what you want. Do some math to calculate the size the group will need to be to have all the rows in the table (I’m assuming the tables anchored to the bottom & top so it can change size with the group). Change the size using system.gui.transform(), then run the function I mentioned, then change the size back. In my test, you can kinda tell the size changed if you use the print dialog. If not, it should be unnoticable. Heres my testing script, assuming the new size is just 10x the original.
cont = event.source.parent.getComponent('Group') origHeight = cont.height newHeight = origHeight*10 system.gui.transform(cont, newHeight = newHeight) job = system.print.createPrintJob(cont) job.setShowPrintDialog(1) job.print() system.gui.transform(cont, newHeight = origHeight)
Tweaking the other print settings might be needed, like the fit to page one if your table is very long.
Try accessing the viewport of the Table to retrieve the extent of the inner view, and temporarily resizing the group and table large enough to encompass it without scroll bars. It’ll extend beyond the window size, but if I recall correctly, it’ll still print.
Thanks for suggestions, they lead me in the right direction to fix my problem. I found that using .print I can supply header and footer information. I ran the .print on the table only and feed the other component’s data I needed as the header. This worked for what I needed. Thanks for the interesting methods that I may end up using in the future.