Text Fields Dont align

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

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

Text Fields Dont align

Post by wee wullie » Tue Nov 04, 2008 11:18 am

I've just started having problems with the alignment of most of the text fields on my printable forms, everything was fine until i upgraded to 2.9 and now its all gone wierd, my app is a report/certificate generator, it has one form for filling in via text fields, combo boxes and list fields etc and it has two printable forms which are the report and certificate, however, when i print them the fields are not aligned properly as they are prior to printing, any suggestions?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Tue Nov 04, 2008 1:57 pm

Is this on Windows? Because on Windows, you have to take the 'formatForPrinting' stack property into account to compensate for the OS-level differences between on-screen fonts and printer fonts.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

format for printing

Post by wee wullie » Wed Nov 05, 2008 1:17 am

Hi Jan, thanks for the reply, this problem happens whether format for printing is enabled or not, infact it seems to work slightly better when its disabled, i cant center the fields properly, this is probably not helped by the fact that the fields can contain varying amounts of characters depending on the selections made on the filling in section of the app, the fields that are worst affected are the ones using bold text, its strange!!!


Willie

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

Post by Mark » Wed Nov 05, 2008 1:26 am

Hi Willie,

How exactly do you align text? You can't use spaces to align text, because it will be different on different platforms and sometimes even on different versions of the same operating system and possibly even in different versions of Revolution.

I believe that the text rendering mechanism has change since 2.9, which may explain the problems you are having, especially of you are using older fonts.

Best,

Mark
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

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

spaces?

Post by wee wullie » Wed Nov 05, 2008 10:07 am

Hi Mark,
my two printable forms contain approximatly 17 - 20-ish fields with labels for each field plus about 8-10 more labels per form, i'm using tahoma for fonts, the fields are in bold, two or three fields have a text size of 12 or 14 with the rest using the smallest text size (9), i tried changing them to veranda and then ariel unicode but it made no difference, on some parts, you still only see part of your text, even if you stretch the fields and labels across the form and by the way, if i enable format for print, half of the fields and labels shift about an inch to the left of the form and it is extremely difficult to align it all and as i said, it looks and aligns better with it disabled, i dont get it.
I think you might be right about the change in text formatting with rev 2.9, i've been using 2.7.4 up until now without any problems.

willie.

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

Post by Mark » Wed Nov 05, 2008 10:14 am

Hi Willie,

Are you sure that your label fields are not covered by other objects?

What happens if you copy such a field to a new, clean stack? Does it change anything?

Best,

Mark
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

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

i'll try

Post by wee wullie » Wed Nov 05, 2008 10:43 am

Hi Mark,
I'll give that a try, i was also going to try using a fresh set of fields and labels on one of the forms but i'll try that first.

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

no change

Post by wee wullie » Wed Nov 05, 2008 12:09 pm

No joy, its still the same, i'll try replacing the fields and labels on one of the forms and see how it goes, if that works i'll do the same with the other form, failling that, i'll re-do the whole app in rev 2.7.4 as i'm finding 2.9 a little buggy for this particular app, i'm getting a fair amount of rev crashes, it has crashed about a dozen times since i installed it and as i said, i had no problems at all with 2.7.4.

kindest regards,
Willie.

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

Post by Mark » Wed Nov 05, 2008 1:27 pm

Willie,

Did you copy the fields to a new stack? What exactly happened?

Mark
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

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

just the same

Post by wee wullie » Thu Nov 06, 2008 12:50 am

Mark,
I tried copying my fields over to a new stack and they behaved exactly the same, however, i did uncheck the 'share text' and 'lock text' boxes to see what would happen and it looks a lot better, i'll try messing about with it some more.

Cheers,
Willie.

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

cant change scale

Post by wee wullie » Thu Nov 06, 2008 2:20 am

I think these problems may be down to/not helped by the print scale, i dont seem to be able to change the print scale, i'm using the open printing with dialog command i.e.

Code: Select all

open printing with dialog
set printpapersize to 595,842  
set printmargins to 10,10,10,75
set the printscale to 0.8
print this cd from 10,10 to 595+75,842-90 into 10,10,595,842+30
close printing
The printscale stays the same regardless of how i set it, is there a problem with using the printscale command with the open printing with dialog command?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Thu Nov 06, 2008 7:06 am

The 'printscale' will be ignored when you use 'print from <point> to <point> into <rect>' - but apart from that, it is important to use 'formatForPrinting' properly.
  • Use a separate stack, where the user cannot enter data.
  • Setup your layout, set the 'formatForPrinting' of the stack to true
  • Use Close and remove from memory to close your printing stack (or quit Revolution to make sure it is removed from memory)
  • Then open it again, fill it with data by script, and print.
If you want an example stack, PM me with your email address.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

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

Post by Mark » Thu Nov 06, 2008 9:44 am

Hi Willie,

I don't think that sharedText, lockText, printScale etc. will solve your problem.

What happens if you make an otherwise completely empty stack, create one new field on it with one word, and execute

Code: Select all

print this card
from the message box? Can you see the whole word on the print?

Best,

Mark
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

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

That works

Post by wee wullie » Thu Nov 06, 2008 10:29 am

Hi Mark,
I tried that and it works and prints perfectly, the field re-sizes even when set to bold.
On my stack, the text disappears when i try to re-size any of the fields unless i make the field extra long i.e. if a field has between 5 and 7 chars i need to size it for three or four times that in order to see the text, this is whether justified left, centre or right.

Willie.

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

Post by Mark » Thu Nov 06, 2008 1:46 pm

Hi Willie,

If I understand this correctly, you create a field in your stack and put text into it. If you print it immediately, it works fine. Then something happens and it doesn't print correctly anymore.

What is the "something" that happens? Do you resize the stack? Anything else?

Can you still see the complete text in the field on your stack, after printing?

Best,

Mark
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

Post Reply