April 25, 200520 yr I would like to create a set of buttons that would control the text alignment of a field: Button1=Left Justify Button 2= Center Button 3 = Right Justify I've looked through ScriptMaker, and if it is already there I'm just totally missing it. Any thoughts, ideas, samples out there? Thanks in advance.
April 26, 200520 yr Therre is no native way to create buttons to do this. It may be possible through AppleScript. Why not use the Format menu?
April 26, 200520 yr A possible workaround, if you want to align the entire field, is to make 3 calculated fields and overlay them as merge fields on the layout. Align the first one left, the second centre and the third one right. Use the buttons to enable one of the three fields like this: LeftAligned = Case(gLeft;TextField;"") MiddleAligned = Case(gMiddle;TextField;"") RightAligned = Case(gRight;TextField;"") The script attached to the Left button would be: Set Field [gLeft; 1] Set Field [gMiddle;0] Set Field [gRight;0] The script attached to the Middle button would be: Set Field [gLeft; 0] Set Field [gMiddle;1] Set Field [gRight;0] The script attached to the Right button would be: Set Field [gLeft; 0] Set Field [gMiddle;0] Set Field [gRight;1]
April 30, 200520 yr Author Okay...I give. I'm trying to implement BobWeaver's suggestion here...but I can't figure out what "gLeft", "gMiddle", and "gRight" are in the Case statements. Are those Globals? Do I make fields with those names? Help. Thanks in advance.
May 1, 200520 yr Attached is my crack at this. notes: - you can not enter the field using the tab key because you need to run a script whenever a user tries to enter the Text field. - When you use a button to align the text the color of the text in the Text field is set to white so that it matches the background. the Text field is also behind the three merge fields so the white text does not block out what the merge fields will display. Why set the text to white? Besides blending with the background you can search the Text field in find mode. (My original workaround simply put the contents of the Text field in one of the three alignment fields once a button was used. I then realized this would make finds complicated because the contents of the field would be spread over 4 fields.) MyDB.zip
May 1, 200520 yr Hi mKirk, tray this, Base is Attachment created by sbg2. Difference is that in my attachment you need one script and one baton. Happy Filemakering Ino
May 1, 200520 yr Nice and efficient. No explanation? The trick is to have one of three alignment fields set with a fill color that matches the background and that field should be arranged in front of the text field. The other two alignment fields should have a transparent fill and be arranged in front of the filled field. All alignment fields should be set to NOT allow entry in Browse or Find Mode, the Text field should be allowed to be entered in both modes (no entry was allowed in Find mode in comments example). You also might want to allow advancement to the next field using the tab key. Note: One potential problem? The user can break the ability to align the text using the provided buttons by using the align text buttons on the toolbar or by using Align Text from the Format menu. I was a little disappointed to find that the text in a field will not export with (alignment) formatting unless the field has been aligned to something other than the default alignment.
May 1, 200520 yr If the user has access to Format menu or to the text formatting toolbar, then this is an excercise in futility. It may very well be even so...
May 1, 200520 yr Author Thanks to all who posted replies... comment...you nailed what I was looking for...I was just missing one thing from where you were. And no, at least in my solution the user will not have access to Format, so this works great...thanks!
Create an account or sign in to comment