Jump to content

Indent in calculation


This topic is 6435 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Any ideas for this would be great...

I am building a dynamic label printing database... Developers Custom functions have been a dream come true and i have achieved everything i desired and it all looks elegant... Until this.

OK trying to avoid my clients getting layout access

They now have customisation of font name, style, style (per line), color, vertical and horizontal alignment. Only thing is some will want to indent the text...

OK i thought they choose the indent number my calc says...

Choose ( indent_number ; "" ; "_" ; "__" ; "___" ; "____" ; "_____" ; "______"...

(spaces get wider can't see in post so used underscore)

sweet ... until

___my line is longer than

one line

___and my text begins

___to look like this

Any ideas that look elegant ... oh and a text field sliding left during printing does not work either as the text on right ends up getting cropped....

can't wait for a couple more ideas ... ideas are good enough even if you haven't done it ... can probably work out.

stuart

Edited by Guest
Link to comment
Share on other sites

If you don't have lots of label layouts, you could take the crude approach and create Layout 1 with no indents, Layout 2 with 1 indent, etc.

There is also a custom function by Ray Cologon on Brian Dunnings site called 'Abscind' which justifies text based on a fixed column width which you may want to look at: Link

Steve

Link to comment
Share on other sites

There's also another technique that can give the user some idea of how it will look. Sorry I can't remember whose idea it was but ----

You set up a repeating global Container field. Each repetition holds a different sized blank picture.

You use the indent value to select the correct repetition which is Set Fielded into a container field on the side of the layout.

Sorry if that's horribly vague. If you are interested I'll post more details. (I have it in one of my solutions.) Even better, maybe the genius who devised it will own up or point you to the Post.

Link to comment
Share on other sites

Hi Steve,

Thanks for your reply... This is a good find and although not the solution for my needs, exactly the kind of brain food i need for this problem...

I am partacularly interested in the fact that Brian --(Edit... Sorry Ray)-- nests the custom functions which i have never before considered and think may take me closer to a solution to this issue.

great... thanks again

stuart

Edited by Guest
Link to comment
Share on other sites

Hey Fogey :

I think this maybe the method that I mentioned much like using blank gif images in html for sizing cells in tables...

you make a global container with reps and in the rep field put a white image 1px width in rep 1, 2px width in rep 2 ... and so on

You make a calc with a container as the result

GetRepetition ( Global_Container ; Rep_Number )

Finally on the print layout you put the container on the far left side and under "graphics" align image on the left and do not resize, under "printing and sliding" tell the calc result box to slide left based on contents then but your text field up to it and tell it to do the same...

The issue I have with this method is that you have to keep the size of the text field the same so the whole thing slides right eventually cropping the far right of the text... you also have no right margin control which you potentially have with the calc approach...

Does your application of this method differ in anyway that may feed my desire to crack this one once and for all?

Thanks again for your time

Stuart

Link to comment
Share on other sites

Ok... Only semi accurate way out of this I can see is slightly insane... but never said I wasn't.

Now I can see a reasonable way of editing a body of text with a nested custom function only thing left is to know exactly how long the lines of text are (in pixels) ...

Answer: Font database with pixel measurements of characters to relate to pixel widths of text boxes:

each record contains

1. a font face/name

result = limit to Arial, Courier, Helvetica, Lucida Sans, Times New Roman, Verdana

= 6 Combinations

2. a font size

limit to 6,9,10,11,12,14,18,24,48,72

result=10 combinations

3. font style (or combination)

limit to (plain - default) bold, italic, underline and uppercase

result = 15 combinations

6 x 10 x 15 = 900 font records

whats in the record?

There are 4 major font width differences

i 1 | l ' , . : ; ! I ...are thin

t f j ) ( { } ] [ " * ...are medium

q e r y u o p a s d f g h k z x c v b n ? / < >£ $ ^ & _ - + = 2 3 4 5 6 7 8 9 0 ...are standard

w m @ % QWERTYUOPASDFGHKLZXCVBNM ...are wide

so we measure

thin_character

medium_character

standard_character

wide_character

900 x 4 =3600 field entries for 6 standard fonts

this sorts out the required mearurements to reasonably confidently calc the indent

hmm is it worth it?:

(ps built the database for visually measuring fonts which works very well & created records with loop script for all fonts on my mac ... 11904 records (maybe not... x 4 is a lot of field entry time for an indent)

OK so now i have an answer (and if i data entry 3600 records the solution) anyone got a shotcut or completely different solution...

still looking for ideas...

attached is a pic of the font setup layout...

Picture_26.png

Edited by Guest
Link to comment
Share on other sites

Lets face it this ain't practical :

After a bit of thought will replace indent term for borders (side only so i crop as little off of long address labels as possible)

Gonna do text calculation fields that display after testing alignment and border field (fields are transparent and overlayed)

1. 9 field variations for alignment

- top left

- top centre

- top right

- centre left

- centre centre

- centre right

- bottom left

- bottom centre

- bottom right

2. 4 field variations for borders

_ a (set as default)

__ b

___ c

____ d

Border widths available to the user will come from a label template database...

9 x 3 = 36 overlayed fields per label (hope this doesn't slow my layouts during printing)

again any other ideas...

Edited by Guest
Link to comment
Share on other sites

  • 2 weeks later...

Stuart,

I think you've become over-enthusiastic about the problem instead of the solution.

:wink2:

The use of variable sized containers does have the problem of no RH margin but you can cater for that by making your fields two lines high and then fix the RH margin. Make the fields sliding up of course.

I gather from your posts that your users can see roughly how their labels will look? If that's correct, you might like to look at my solution to a similar problem. This was the need to make company names single lines on a certificate. I set up a field that is the same size as the name field and let the user either abbreviate the name or change the font size. (It is amazing how much you can vary a font size before it becomes really obvious.) It wouldn't be too hard to 'move' the LH field border to emulate the indent.

Link to comment
Share on other sites

There's also another technique that can give the user some idea of how it will look. Sorry I can't remember whose idea it was but ----

You set up a repeating global Container field. Each repetition holds a different sized blank picture.

You use the indent value to select the correct repetition which is Set Fielded into a container field on the side of the layout.

I posted a method something like what you describe. Not sure if it's the one you mean, but it's here:

http://fmforums.com/forum/showtopic.php?tid/77981

Link to comment
Share on other sites

  • 2 months later...

Hi sorry got a little side tracked ... missed your updates

Thats definitely the best solution available that i can find... but it still leaves an issue when applying it to labels as the label field area must be smaller than the greatest indent.

If there where only some kinda wrap testing functions.

Thanks to you both ... sorry for the delay in appreciation ... I tend to have spurts on the forum rather than regular weekly visits then i get obsessed with my solution until i hit a wall.

Oh whenever i post i try to help someone too ... as others have done for me.

Great Community.

Edited by Guest
Link to comment
Share on other sites

  • 4 weeks later...

There is actually a way to test whether the text in a field has wrapped to the next line, but it has to be done by script. In layout mode, make a copy of the field. Create a new layout "TestLayout" and paste the copy of the field so that it straddles the page boundary, in such a way that the first line of text appears just above the page boundary, and the remainder is below. Set the field to slide and shrink enclosing part. Then place a non sliding object directly above the field. This will prevent the field from sliding and will only allow it to shrink. The idea is that if the text all fits on one line, then it will all fit on one preview page, but if it wraps to the next line, it will force a second page in preview mode.

Then the script is a standard page counting script:

Enter Preview mode

Go to Layout [TestLayout]

Go to Record/Request/Page [last]

If [Get (CurrentPageNumber)>1]

__#Text has wrapped, so handle that case here

Else

__#Text has NOT wrapped, so handle that case here

End If

Enter Browse Mode

Link to comment
Share on other sites

This topic is 6435 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.