kiwiora Posted February 17, 2005 Posted February 17, 2005 Hi, I would like to specify the maximum field size. (NOT number of characters) I have created a label generator for spines of folders. Obviously it is a fixed size. At the moment, as you type text, the field will stretch to accommodate extra content and then on exit display only that content which fits the field. I cannot specify the number of characters as the user may increase/decrease the font size which obviously alters the number of characters. I just want to set the ability for the field to stretch to OFF or some such thing so you simply can't type anything further in past the size as set on screen. Cheers
stanley Posted February 17, 2005 Posted February 17, 2005 Kiwiora: There's probably a plugin for this, but you can also put a scrollbar in the field, which will cause data to scroll off the top of the field as the user types; this way they *know* that they're going beyond the borders of the field. -Stanley
Brian C Posted March 4, 2005 Posted March 4, 2005 You can do this by making use of the validation options and inputting a calculation that must always evaluate to TRUE. For example in version FMP v6 I would use: length(fieldname) ? 10 As long as you use something like this and you have the option set so that the user is not allowed to override the validation, the user will never be able to enter a value longer than the maximum number.
kiwiora Posted May 13, 2005 Author Posted May 13, 2005 Brian C - you've missed the original point sorry. It's not the length that's the problem persay, it's the size -v- length. i.e you can fit 20 characters at 10point but only 5 characters at 24 point. So your solution at 24point would be incorrect as the size is what makes it too big, not the length.
Ender Posted May 13, 2005 Posted May 13, 2005 If you know the size of the font and the font family, you could use a calculation or custom function to derive the width in pixels. Check this thread: http://www.clevelandconsulting.com/support/viewtopic.php?t=510 Unfortunately, this would be difficult to implement if the user could change the font or size. I'm not sure if this would be easier, but you might consider a solution where the user enter the text for the label in a default font size, then use a calc to resize it to make it fit.
kiwiora Posted May 14, 2005 Author Posted May 14, 2005 Hi Ender, Unfortunately I have to allow the user to resize the font to suit their requirements so am unable to "fix" font size. If only you could stop a field from "stretching" bigger than the on-screen field size. I'm going to have a think more on your suggestion though thanks Ender. I might try setting up a field where they enter the size of the font they want, and then I can set the number of characters by calc that is allowable in the field from the font size they've selected.
BobWeaver Posted May 14, 2005 Posted May 14, 2005 I have used a technique to detect when the amount of text caused the field to expand beyond its original size. It's kludgy, and a bit slow but if you only execute it as part of a validation script when the user enters the field data it may be okay. It works by going to a different layout with the text field by itself set to slide/shrink and reduce enclosing part. The field is the same width as the original, but longer, and straddling a page break. The script goes into preview mode and counts pages. If the text fits the field, the report will only be one page long. If there is too much text, there will be more pages. I have attached a file that demonstrates this. You will likely need to adjust the parts on the test layout to get it to work properly. Because it tends to require tweaking between different platforms, I generally haven't recommended this technique. But then, I haven't really tried it since switching to FM7. FieldSizeTest.fp7.zip
Recommended Posts
This topic is 7134 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 accountSign in
Already have an account? Sign in here.
Sign In Now