Why this problem

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
dalkin
Posts: 106
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Why this problem

Post by dalkin » Sat Jul 07, 2007 2:49 am

Using this script on a "Print" button causes the printing to hang, forcing a force quit of Revolution. There's an endless loop somewhere but I can't find it. Rev 2.8.1 on Mac OSX 10.4.10.

If I take out the 2nd line, "open printing with dialog", it works fine but goes straight to the last selected printer, removing the page setup and number of copies function of a normal printing dialog.

Any help appreciated.

on mouseUp
open printing with dialog
hide button "Print"
hide button "Next Screen"
hide button "Previous Screen"
hide button "Main Screen"
hide button "Ideas"
set the printScale to .6
print this card
show button "Print"
show button "Next Screen"
show button "Previous Screen"
show button "Main Screen"
show button "Ideas"
end mouseUp

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Sat Jul 07, 2007 3:49 am

Hi dalkin~

Try changing the order of your "open print with dialog" call. Set up all the formatting or hiding of objects prior to calling any print routine that interacts with the print driver.

Code: Select all

on mouseUp 
  hide button "Print" 
  hide button "Next Screen" 
  hide button "Previous Screen" 
  hide button "Main Screen" 
  hide button "Ideas" 
  set the printScale to .6
  open printing with dialog  
  print this card 
  show button "Print" 
  show button "Next Screen" 
  show button "Previous Screen" 
  show button "Main Screen" 
  show button "Ideas" 
end mouseUp

dalkin
Posts: 106
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Post by dalkin » Sat Jul 07, 2007 4:02 am

thanks Lynn, still no luck I'm afraid. Same hang. It looks like the problem is that the call to "open printing ...", prior to the appearance of "print this card", hasn't specified what is to be printed. I've purchased and downloaded the http://www.shafermediastore.com "Printing in Revolution to OSX" and I'll see if I can sort it. Thanks for your advice though.

dalkin
Posts: 106
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Post by dalkin » Sat Jul 07, 2007 5:12 am

Hmm ... this looks like a logic problem to me, not necessarily a bug but I think it's got 6 legs"

As before:

on mouseUp
hide button "Print"
hide button "Next Screen"
hide button "Previous Screen"
hide button "Main Screen"
hide button "Ideas"
set the printScale to .6
print this card
show button "Print"
show button "Next Screen"
show button "Previous Screen"
show button "Main Screen"
show button "Ideas"
end mouseUp

This works as expected and the card is printed to the last used printer. The "show" and "hide" are generic to the card and not of consequence (I would have thought) to the script or its function.

When I add the "open printing with dialog" command however, no matter where I place it in the script, it causes the script to hang. Logic would suggest that "open printing with dialog" is incompatible with "print this card". The "open printing with dialog" command, if it's placed before "print this card" hasn't told the system what to print, surely. If it's placed after "print this card", the print command has already been sent to the printer (without dialog) and the user can't set eg. the number of copies etc.

Result? Hang!

The booklet I downloaded says at one part: "On OSX, append the with dialog option to the open printing command (Note that you cannot use this option with the stand-alone print command". I've asked the author to clarify.

kpeters
Posts: 112
Joined: Wed Mar 21, 2007 9:32 pm
Location: Kelowna, BC, Canada

Post by kpeters » Sat Jul 07, 2007 5:51 am

Hmm - same OS & Rev version here. Using your code here's what I see:

Print dialog shows
I click Print
Print progress dialog pops up
I can click cancel on that - if I do, things get ugly - it hangs and Rev hangs...

Does that match what you see?

Kai

dalkin
Posts: 106
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Post by dalkin » Sat Jul 07, 2007 6:03 am

Yes, that's it. Glad you could duplicate it. Where to from here? I'm too new to Rev to know if it's a bug or whether I'm making some sort of mistake.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Jul 07, 2007 10:00 am

Hello,

To make the OS actually execute the print job and have Revolution continue with other duties, you need to close printing after opening it.

Code: Select all

on foo
  open printing with dialog
  -- print this print that
  close printing
end foo
Best,

Mark
[/img]
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dalkin
Posts: 106
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Post by dalkin » Sat Jul 07, 2007 12:04 pm

Three cheers Mark! Many thanks.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”