mKirk Posted April 25, 2005 Posted April 25, 2005 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.
Vaughan Posted April 26, 2005 Posted April 26, 2005 Therre is no native way to create buttons to do this. It may be possible through AppleScript. Why not use the Format menu?
BobWeaver Posted April 26, 2005 Posted April 26, 2005 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]
mKirk Posted April 30, 2005 Author Posted April 30, 2005 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.
sbg2 Posted May 1, 2005 Posted May 1, 2005 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
ino Posted May 1, 2005 Posted May 1, 2005 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
sbg2 Posted May 1, 2005 Posted May 1, 2005 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.
comment Posted May 1, 2005 Posted May 1, 2005 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...
mKirk Posted May 1, 2005 Author Posted May 1, 2005 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!
Recommended Posts
This topic is 7149 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