New to HyperCard, can't locate print template after migratio

Working on making the switch to SuperCard? Many here have done it... ask your questions here.

New to HyperCard, can't locate print template after migratio

Postby oz81dog » Wed Dec 19, 2012 4:32 pm

Hi,

This question is probably a pretty dumb one as far as they go, but I need to ask it.

I'm in the process of migrating a HyperCard project over to SuperCard and the project had a print button in it that when pressed ran this code:
Code: Select all
open report printing with template "Ultrasound Report"
print this card

I can't seem to get this to work and I can't find a place to find or edit the report of that name either. I think it's just a case of not knowing my way around the program more than anything else.
oz81dog
 
Posts: 4
Joined: Wed Dec 19, 2012 12:29 pm

Re: New to HyperCard, can't locate print template after migr

Postby codegreen » Wed Dec 19, 2012 8:39 pm

HyperCard contained a facility for generating reports from the contents of stacks. SuperCard does not. To implement something similar you'll have to roll it yourself. This involves a bit more work, but gives you finer control over the output.

Basically you'd create an offscreen or hidden window with a bg whose backSize matches the printable area of your printer's page (which you can obtain via the global printableRect property). Loop through the cards in your main window and extract the data of interest, format it as necessary, stuff it into the display fields, and print the card. You'll probably want to print the whole thing in a single batch (see 'open print job') to speed things up and prevent pages from other jobs from getting interleaved.

-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Re: New to HyperCard, can't locate print template after migr

Postby codegreen » Wed Dec 19, 2012 8:58 pm

BTW rolling things up into a single print job is probably something you should tackle AFTER you get everything else working. Batch printing can make debugging basic layout issues needlessly painful...

-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Re: New to HyperCard, can't locate print template after migr

Postby oz81dog » Thu Dec 20, 2012 2:28 pm

Well, step one, debugging the code is all done. Everything is working great. This next step though is going to be tough for me as I'm learning everything from scratch here.

How or where can I access the global printableRect property?
oz81dog
 
Posts: 4
Joined: Wed Dec 19, 2012 12:29 pm

Re: New to HyperCard, can't locate print template after migr

Postby codegreen » Thu Dec 20, 2012 3:21 pm

oz81dog wrote:How or where can I access the global printableRect property?

Code: Select all
get the printableRect
set the backSize of <bkgndDesc> to item 3 to 4 of offsetRect(it, -item 1 of it, -item 2 of it)

HTH,
-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Re: New to HyperCard, can't locate print template after migr

Postby codegreen » Thu Dec 20, 2012 3:52 pm

BTW this (i.e., explicitly setting the backSize of your print card to match the printableRect) is just one of several possible strategies you could adopt for creating a report. It's the most 'nuts and bolts' way of doing things, but depending on what you're trying to print (and how many types of printers you're supporting, how important maximum print quality is, and how you define that) it may or may not be optimal...

For example SC can also apply 'fit-to-page' scaling when printing a card, so you could define a 'standard' report card at some handy size (presumably with your target aspect ratio) and then just use the 'scale' option when printing the card(s) to account for differences in your end-users' logical page size. Depending on the dimensions you choose and your printer driver, this may produce better or worse quality output than printing an 'exact' size card.

-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm


Return to Upgrading From HyperCard

Who is online

Users browsing this forum: No registered users and 1 guest