Page 1 of 1

Help with Centered Page Numbers

Posted: Mon Sep 17, 2012 3:49 am
by AtoZ
I'm trying to print a field using the revPrintText command because I want to place a centered page number in the footer of the page, but I am having trouble getting the page number centered.

The following command, currently part of a mouseUp handler for a button on the card with the field I want to print, works fine -- if I wanted the page number set flush left:

Code: Select all

revPrintText the htmlText of field "Report", ,"-- <%pageNumber%> --" 
The LiveCode dictionary entry on revPrint Text says the following:
The headerText and footerText can contain up to two tab characters:
* Everything up to the first tab character is left-aligned.
* Everything between the first and second tab characters is centered.
* Everything after the second tab character is right-aligned.
If the headerText or footerText contain more than two tab characters, everything after the third tab is ignored.
What is not spelled out, or shown in any example I can find, is how to insert the tab characters into the command

I have tried a variety of possibilities:

1. Putting "tab &" after the second comma just results in "tab &' being printed just before the page number.

2. Putting the same text just after the first quote mark in the the third item of the command, produces the same result.

3. Putting "<%tab%>" just after the first quote mark in the third item of the command, indents the page number a few spaces.

4. Putting a second "<%tab%>" after the first one, also indents the text instead of centering it.

I've spent some time looking through the "User Guide", the LC Dictionary, the LC forum, the LC list archives, the tutorials, revOnline, and User Examples, without being able to locate any further information or examples of the correct code.

Any suggestions?

Re: Help with Centered Page Numbers

Posted: Mon Sep 17, 2012 11:00 am
by Klaus
Hi,

use TAB without Quotes!
TAB is a CONSTANT, "TAB" is a string!

...
put TAB & TAB & "-- <%pageNumber%> --" into myFooter
revPrintText the htmlText of field "Report", ,myfooter
...


Best

Klaus

Re: Help with Centered Page Numbers

Posted: Mon Sep 17, 2012 7:21 pm
by AtoZ
Thanks Klaus,

I do know the difference between constants and strings. The quotes in my message were there to separate what I typed from the surrounding text. (I should have said "without the quotes" to make it clear, sorry.)

What is frustrating to me is that yesterday using tab (without quotes) did NOT work for me, but today it does. I've no doubt that I did something wrong yesterday but it wasn't because of the quotes. Anyway, I'm glad it's working now.

Now I just have to figure out why the tabs settings for the main body of my report were working fine yesterday and today the tabs respond differently depending on the number of characters in the previous column. (For example, in the first column of my report, the column head is the word "Number" while the entries in the column below are short numbers like 1,2, or 3. Yesterday, the text in the second column aligned perfectly regardless of the length of the entries in the first column. Today, the second column entries are indenting differently for short numbers in column one than for the longer text in column 1. It's not just in column 1 that his is happening, it doing this throughout the report. Again, I've no doubt done something, unintentionally, to mess things up, but the few changes I've made today should not have done this. I don't expect anyone to be able to solve this without seeing the acutally report and my code, I'm just venting my frustration.

Re: Help with Centered Page Numbers

Posted: Mon Sep 17, 2012 7:32 pm
by Klaus
Hi Atoz,

I know exactly how you feel, I have experienced a lot of Voodoo/paranormal activity
in the last 13 years working with MetaCard/Revolution/Livecode!


Best

Klaus