Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

script step to change the aligment of a text field: possible?


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

Recommended Posts

Posted (edited)

For a module that generates text overlays over two superimposed picture container fields (one = background; the other a half transparent PNG image) I want to be able to change by script the alignment settings of my Text overlay field on a specific layout (using for instance its object name).

I may have overlooked a function or workaround, but till now it seems to me that this not possible. Suggestions (also for plug-ins allowing this) are welcome...

Edited by Guest
Posted (edited)

I don't think there's a specific script step to do this, but I'm assuming you only want one of three possible alignments - left, center, and right? If that's the case, create three separate fields, one called left, one called center, and one called right. Then format their text respectively, and lay them one on top of each other.

As far as how to get your text in the fields, I don't know if you are typing into those fields, or if it is auto entered based on other fields. If it's typing then, In your script add the steps to clear each of the fields:

Clear

Clear

Clear

Then in the script it can insert text into the field that corresponds to the alignment you want, or go to that field to be typed into. If it's auto enter, you may need to use an IF:

IF [Object = A]

Insert text [Left; blah blah blah]

Esle IF [Object = B]

etc then be sure to add End IF

If it's automatically entering the info based on what's in other fields, then instead of the above steps, do this: make each of those alignment fields a calculation, and put in the following:

Case (Object = A ; "blah blah blah" ; "" )

Just redo each one for it's correct info. In case your not familiar with the case statement, here's how it works. Notice each section is separated by a ; - you have 3 parts, and those are test, result and default result. The first part (Object = A) is the test. It's checking to see if what's in that field is A. If it is, then the next section kicks in, the result. That is the "blah blah blah" part. So if the contents of your object field is A, then this field will come up as blah blah blah, otherwise it will move on to the default result, which is "". That will make this field blank.

You can have as many tests and results as you want with a case statement - we only need one here, but if you wanted more it's just simply test ; result ; test ; result ; test ; result ; default result

So it will do the first test and if it's true, then it will use that result, otherwise it will move on to the next test and so on. If it gets to the end and none of the tests were true, it will put in the default result.

Edited by Guest
Posted (edited)

Further clarification: substitute replaces content but does not replace formatting. So if A is text with applied formatting such as font sizes, font colors, and tab settings, and B is plain or styled text with other settings, then the result of the following is the content of B with the applied formatting of A.

Substitute( A; A; B )

Note that if A has multiple (return delimited) lines of text each with different applied formatting, then you will get different results when you change N in the following:

Let( N = 1;

Substitute( getValue( A; N ); GetValue( A; N); B )

)

Edited by Guest
Posted

Thank you very much for your reaction... that is truly a workaround and your suggestions are helpful to me a a researcher usinf Filemaker for many years, but not being a programmer myself. Your suggestion looks like a true workaround, ehich can be a sport with FMP...

Posted

Very useful and with a neat example... (is it something from your shelves?) It comes close to what I need it for.... I am generating hundreds of small jpgs for roll-over menu in html; each rollover image has a background differing PNG transparencies and text calculated from a related database... I want to make this thumbnial generator into a flexible tool for several projects and different graphic needs; Your solution somehow relates to the first reaction to my post... Thanks a lot...

Posted

I have not been aware of the retaining of the formatting of a field when using substitute...

Somthing (as far as I can see) "not in the manual"; not even in the Filemaker pro 10 'the missing manual' book which I bought recently and which often does not supply what it suggests it will...

This topic is 5405 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.