dbTalk Databases Forums  

forcing a font

comp.databases.filemaker comp.databases.filemaker


Discuss forcing a font in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill Steele
 
Posts: n/a

Default forcing a font - 07-02-2007 , 01:00 PM






I have a text field whose font preference is set to Arial, input method
is set to "synchronize with field's font." If someone types in the
field the text is Arial. If someone drags text into the field it becomes
Arial. But if someone pastes text into the field it retains its original
font, which is bad for complicated reasons. Is there any way to force
pasted text to change to the field's preferred font?

Reply With Quote
  #2  
Old   
Sean Walsh
 
Posts: n/a

Default Re: forcing a font - 07-02-2007 , 02:11 PM






On 2007-07-02 13:00:56 -0500, Bill Steele <ws21 (AT) cornell (DOT) edu> said:

Quote:
I have a text field whose font preference is set to Arial, input method
is set to "synchronize with field's font." If someone types in the
field the text is Arial. If someone drags text into the field it becomes
Arial. But if someone pastes text into the field it retains its original
font, which is bad for complicated reasons. Is there any way to force
pasted text to change to the field's preferred font?
What version are you using?



Reply With Quote
  #3  
Old   
Bill Steele
 
Posts: n/a

Default Re: forcing a font - 07-05-2007 , 02:12 PM



In article <2007070214114416807-walshsr@yahoocom>,
Sean Walsh <walshsr (AT) yahoo (DOT) com> wrote:

Quote:
On 2007-07-02 13:00:56 -0500, Bill Steele <ws21 (AT) cornell (DOT) edu> said:

I have a text field whose font preference is set to Arial, input method
is set to "synchronize with field's font." If someone types in the
field the text is Arial. If someone drags text into the field it becomes
Arial. But if someone pastes text into the field it retains its original
font, which is bad for complicated reasons. Is there any way to force
pasted text to change to the field's preferred font?

What version are you using?
8.0


Reply With Quote
  #4  
Old   
biberkopf
 
Posts: n/a

Default Re: forcing a font - 07-09-2007 , 02:50 PM



On 2 Jul., 20:00, Bill Steele <w... (AT) cornell (DOT) edu> wrote:
Quote:
I have a text field whose font preference is set to Arial, input method
is set to "synchronize with field's font." If someone types in the
field the text is Arial. If someone drags text into the field it becomes
Arial. But if someone pastes text into the field it retains its original
font, which is bad for complicated reasons. Is there any way to force
pasted text to change to the field's preferred font?
There is a way to force a phone number into a certain format, e.g. ###-
####-####.
I believe the same technique can be used here.

Add an auto-enter calculation to your input field. Set the calculation
to something like this:

If(Length(input_field) >0 ; TextStyleRemove(input_field;
AllStyles); input_field)

You should also uncheck the box "Do not replace existing value of
field (if any)".

Ths should do the trick.

If you want to make really nice, you can make it into a custom
function with a number of variables, in order to better control which
styles and formats you want to zap and which to preserve. Check out
the various text formatting possibilities in the help menu.

Remember to share your custom function with the rest of us at
briandunning.com - maybe there's already a CF for you there.




Reply With Quote
  #5  
Old   
Helpful Harry
 
Posts: n/a

Default Re: forcing a font - 07-09-2007 , 11:08 PM



On 2 Jul., 20:00, Bill Steele <w... (AT) cornell (DOT) edu> wrote:
Quote:
I have a text field whose font preference is set to Arial, input method
is set to "synchronize with field's font." If someone types in the
field the text is Arial. If someone drags text into the field it becomes
Arial. But if someone pastes text into the field it retains its original
font, which is bad for complicated reasons. Is there any way to force
pasted text to change to the field's preferred font?
Another way to add to the other suggestions, is to have a second
version of the field which is a Calculation field set to simply "copy"
the field the users can paste into.
ie.
c_DataField Calculation (Text Result), Unstored
= UserField

The c_DataField is the one you use for printouts, etc. Unlike the Copy
command, the Calculation only takes the data, not the formatting.


With some Layout trickery you can also make it so that users only see
the "fixed" version.

Put both fields on the Layout, with the UserField hidden beneath the
c_DataField, making sure to turn OFF the "Allow user entry" Field
Format option for the c_DataField. Also remove c_DataField from the
Layout's Tab order. That way when users click on or Tab to the "single"
field they are taken to the UserField, but otherwise only see the
correctly formatted c_DataField.

The only real problem is that when users do click / Tab into the field
they will see the original incorrectly formatted version, but there is
a way around that too. You will also need to do some extra work if the
Layout is also used to perform Finds.


With even further trickey you can set the c_DataField to act as a
button that runs a script. The script can copy the contents from the
correctly formatted c_DataField back into the User field when it is
clicked on before letting the user see it.
eg.
Set Field [UserField, c_DataField]
Go To Field [UserField]

Similar to using a Calculation, the Set Field command only takes the
actual data, not the formatting (unlike using the Copy and Paste script
commands, which do take the formatting).

The problem is that you can't run a script when the user Tabs into the
field ... unless you have an extra plug-in.


If the Layout is being used to perform Finds, then you need to use the
"button" script technique, but modify the script to allow for Find mode
- when in Find mode simply go to the c_DataField instead of the
UserField. (You don't need to worry about Preview mode or Layout mode
since buttons don't function in either of those modes - make sure the
script is not listed in the Scripts menu so users can't run it by
accident.)
eg.
If [Get(CurrentMode) = 0]
# 0 means we're in Browse mode
Set Field [UserField, c_DataField]
Go To Field [UserField]
Else
# otherwise we're in Find mode
Go To Field [c_DataField]
End If

Note: the # symbol is the Comment script command and those two lines
can be left out.

You will have to turn the "Allow user entry" option back on for the
c_DataField, but since it's now defined as a button it doesn't matter
because the user can't click into it (it should still be left out of
the Tab order).

The only problem here is the Tab order when in Find mode. Unfortunately
there's no work-around that can be done to fix that (an extra plug-in
might again help here, but I'm not sure if any of them work in Find
mode).


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #6  
Old   
Matt WIlls
 
Posts: n/a

Default Re: forcing a font - 07-10-2007 , 08:30 AM



In article
&lt;1184010630.087566.159890 (AT) d55g2000hsg (DOT) googlegroups.com&gt;biberkopf
&lt;jespersoholm (AT) gmail (DOT) com&gt; wrote:

Quote:
On 2 Jul., 20:00, Bill Steele &lt;w... (AT) cornell (DOT) edu> wrote:
I have a text field whose font preference is set to Arial, input
method is set to "synchronize with field's font." If someone types
in the field the text is Arial. If someone drags text into the field
it becomes Arial. But if someone pastes text into the field it
retains its original font, which is bad for complicated reasons. Is
there any way to force pasted text to change to the field's
preferred font?

There is a way to force a phone number into a certain format, e.g.
###-####-####.
I believe the same technique can be used here.

Add an auto-enter calculation to your input field. Set the
calculationto something like this:

If(Length(input_field) >0 ;
TextStyleRemove(input_field;AllStyles); input_field)

You should also uncheck the box "Do not replace existing value
offield (if any)".

Ths should do the trick.

If you want to make really nice, you can make it into a custom
function with a number of variables, in order to better control which
styles and formats you want to zap and which to preserve. Check
outthe various text formatting possibilities in the help menu.

Remember to share your custom function with the rest of us
atbriandunning.com - maybe there's already a CF for you there.

There is a rather elegant CF there, TextStyleRemoveAll ( Fieldname ):

Evaluate ( Quote ( FieldName ) )

Matt





Reply With Quote
  #7  
Old   
Bill Steele
 
Posts: n/a

Default Re: forcing a font - 07-10-2007 , 03:35 PM



In article <1184010630.087566.159890 (AT) d55g2000hsg (DOT) googlegroups.com>,
biberkopf <jespersoholm (AT) gmail (DOT) com> wrote:

Quote:
Add an auto-enter calculation to your input field. Set the calculation
to something like this:

If(Length(input_field) >0 ; TextStyleRemove(input_field;
AllStyles); input_field)
Would that also remove any internal formatting, e.g., bold and italic?


Reply With Quote
  #8  
Old   
Bill Steele
 
Posts: n/a

Default Re: forcing a font - 07-10-2007 , 04:14 PM



In article <ws21-457636.16350110072007 (AT) newsstand (DOT) cit.cornell.edu>,
Bill Steele <ws21 (AT) cornell (DOT) edu> wrote:

Quote:
In article <1184010630.087566.159890 (AT) d55g2000hsg (DOT) googlegroups.com>,
biberkopf <jespersoholm (AT) gmail (DOT) com> wrote:

Add an auto-enter calculation to your input field. Set the calculation
to something like this:

If(Length(input_field) >0 ; TextStyleRemove(input_field;
AllStyles); input_field)

Would that also remove any internal formatting, e.g., bold and italic?
And, trying it, it does. It doesn't change the font, but wipes out any
text styles. This works, however:

If(Length(body text) >0 ; TextFontRemove (body text))

It works when the user clicks out of the field. I'd prefer it to be
instantaneous, but this is a definite improvement.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.