Problem with revPrintText

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AtoZ
Posts: 64
Joined: Tue Mar 06, 2012 8:31 am
Location: San Diego, CA

Problem with revPrintText

Post by AtoZ » Sun Sep 16, 2012 1:16 am

I've created a one card stack ,with one field on it, to test printing from a field.

The field is named "Info" and contains styled text such as tabs stops, bold type, and various colors of type.

The field prints perfectly when I use the revPrintField command from the message box. However, I want to add a footer to the page and according to the user manual, the command to use in this case is revPrintText in conjunction with the htmlText function.

The dictionary entry for revPrintText has the following example:

Code: Select all

revPrintText (the htmlText of field "Info"),"Info",the time && the date
If I understand correctly, this code should print the field "Info", put the word "Info" in the header. and the time and date in the footer. But when I copy and paste the line into the message box and execute it, I get the following error message:

Message execution error:
Error description: Function: error in function handler
Hint: revPrintText


Any ideas about what's going wrong?
Using LiveCode 5.5 on Windows 7 Home Premium Edition, Service Pack 1

Image
On my way from A TO Z, I often end up AT OZ.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Problem with revPrintText

Post by sturgis » Sun Sep 16, 2012 1:35 am

The message box sometimes reacts strangely, and in this case it is thinking that revprinttext is a function and its not, hence the error. If you put the code in a button it should work, or conversely, if you remove the () from the script then you can use it in the message box. The () is what confuses things. (the message box has several quirks like this)

AtoZ
Posts: 64
Joined: Tue Mar 06, 2012 8:31 am
Location: San Diego, CA

Re: Problem with revPrintText

Post by AtoZ » Sun Sep 16, 2012 3:49 am

Thanks for the quick reply.

As you said, it does work in the message box without the parens.

This is the sort of thing that drives us beginners crazy. Here's a direct quote from the User Guide:
Tip: The Message Box is one of the more useful components in LiveCode when you are
starting out and wanting to try out simple scripts. You will find you can try out many of
the script examples in this User's Guide or in the getting started materials on our website
simply by copy-pasting them into the Message Box.
I hate to tell how much time I wasted trying various versions of this command in the message box (replacing the field name with it's ID number, etc.). It never occured to me it was the message box itself with the problem. Furthermore, this seems to be a long-standing bug; one would think that if it can't be fixed then at least the User Guide would updated with appropriate cautions.

Thanks for the help.
Using LiveCode 5.5 on Windows 7 Home Premium Edition, Service Pack 1

Image
On my way from A TO Z, I often end up AT OZ.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”