FormatForPrinting

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

FormatForPrinting

Post by dunbarx » Wed Apr 11, 2018 2:24 pm

This got nothing on the use-list, so I am repeating it here:

With regard to formatForPrinting for Windows, the dictionary says to set the property *before* you open the stack. I'm probably just being thick, but how do you set the property of a stack that is not open? Does this really mean to set it to true, save it, close it and then reopen it in order to print accurately? And then if the user wants to make a change to some text, they have to set it to false, save, close, reopen? Then to print a second time go through all of that again? That sounds like a horrible thing to put a user through. Why can’t you set it to true just before you print, then back to false afterward?

Can anybody provide some input on this?

Thanks,
Marty

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: FormatForPrinting

Post by dunbarx » Wed Apr 11, 2018 2:26 pm

I am intrigued as well.

The dictionary is quite clear: Set this property before the stack of interest is ever in
memory.

Does the engine store properties just in case a stack of the appropriate
name opens? Are there other such properties?

Or is it a global property that applies to all stacks, but then they all have to be unopened before they can use it.

The dictionary states that this property can be cleared if text is to be
edited, and then, I assume reset if the user want to print again. So is the
property stored in the stack as well?

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: FormatForPrinting

Post by bogs » Wed Apr 11, 2018 4:39 pm

the dictionary says to set the property *before* you open the stack. I'm probably just being thick, but how do you set the property of a stack that is not open?
Maybe I don't understand the question, isn't that what the 'preOpenStack' message is for?
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: FormatForPrinting

Post by dunbarx » Wed Apr 11, 2018 4:51 pm

Bogs.

I could be wrong, but I think "preOpenStack" appears before any card is drawn, but I do not think it appears before the stack is in memory. After all, what would be receiving that message, except for, er, the stack?

But you might be onto something, if the dictionary intended this, and just did not say so.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: FormatForPrinting

Post by jacque » Wed Apr 11, 2018 5:53 pm

I haven't had to print in years but the last time I did it was to a substack. I set the formatForPrinting to true before opening the stack and it worked. So I don't think "in memory" is accurate since substacks are always in memory. The important part is to set it before the stack is actually rendered. PreOpenStack would probably work for a mainstack.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: FormatForPrinting

Post by dunbarx » Wed Apr 11, 2018 6:27 pm

Jacque.

All makes sense. It is just that the dictionary is so clear on the subject.

If "clear" is the right word.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: FormatForPrinting

Post by bogs » Wed Apr 11, 2018 7:06 pm

dunbarx wrote:
Wed Apr 11, 2018 6:27 pm
If "clear" is the right word.
Yah, that problem I often have when interpreting what the dictionary 'says' vs. what it actually means. Sometimes it is clear as mud :roll:
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: FormatForPrinting

Post by dunbarx » Wed Apr 11, 2018 7:39 pm

Bogs.

You know, I wonder if I am making too big a deal out of this. If the property is a global one, what is all the noise about?

It was just the opening/memory sequence thing, in that the property should be set before the stack is even born. Normally this would not matter, but maybe this particular property doesn't do its job well unless it is already in play.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: FormatForPrinting

Post by bogs » Wed Apr 11, 2018 8:29 pm

Heh, unfortunately, as Smokey the bear use to say, only you can determine if it is too big a deal or not. For me, it is the shortcut keys that rankles.

Besides, I agree with you that it is a weird way of putting something, but that is weird to me, coming as I do from a completely different way of doing stuff. If I had started out in Hc/Mc/Lc instead of the languages I did start with, it might seem completely normal to me. Hard to say.

Also, the read I got from it was a bit different than the interpretation listed in the post you copied. Taken in whole, it seems to say that if your going to print a stack on a windows system only, that you need to set the property to true before displaying the stack (despite the in memory part in parenthesis) due to the way Windows handles fonts differently on screen vs. printing. It also says that text corruption can occur if you change the text in the field while the property is true, etc etc.

So yah, it is weird.

Jacque's explanation sounds the most reasonable to me, but then, except for her variable naming things you know pretty much everything she says sounds reasonable.
Image

SparkOut
Posts: 2834
Joined: Sun Sep 23, 2007 4:58 pm

Re: FormatForPrinting

Post by SparkOut » Wed Apr 11, 2018 9:02 pm

You can have a stack open, set the formatForPrinting and watch the font metrics change on screen. I don't know what other implications there are but afaik it is possible to set and unset while the stack is in memory without any errors. Maybe the reason for rendering for print out of memory (ie offscreen) is to stop a distracting change in the appearance.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: FormatForPrinting

Post by FourthWorld » Wed Apr 11, 2018 11:33 pm

Did anyone file a Bugzilla or pull request for that Dictionary entry to remove the parenthetical part about "(and not in memory)" from the Dictionary's formatForPrinting entry?

That seems to be the source of confusion here, is only partially technically accurate, and explaining it would require far more text about the nuances of how stacks are unpacked from disk than anyone wants to read there. Once that's removed using the formatForPrinting property is straightforward.

Please note the BZ# or PR# when you file it. Thanks.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: FormatForPrinting

Post by dunbarx » Fri Apr 13, 2018 3:34 am

Asked QCC about it

# 21198

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: FormatForPrinting

Post by FourthWorld » Fri Apr 13, 2018 4:04 am

Thanks for submitting that, Craig.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Talking LiveCode”