K1200 Posted February 7, 2006 Posted February 7, 2006 I'd like to put two buttons at the bottom of a data-entry layout to: >>> Set Pen Color Black <<< . . . . . >>> Set Pen Color Red <<< After clicking on one of them, all text that the user types from that point is stored/displayed in that color, regardless of the particular field being typed into. Basically, it's altering the FMP runtime's default text color. Is there a straightforward way to do this?
Raybaudi Posted February 7, 2006 Posted February 7, 2006 Hi yes, it's possible... but I wish for you that your record has no more than 3 or 4 fields ! The trick is an autoenter/replace calculation into the field's definition. (and it will work only for Text fields, not Number neither Date)
K1200 Posted February 7, 2006 Author Posted February 7, 2006 Thanks for the quick response. After reading up on Auto-enter Calculations -- and then trying an example -- I was able to apply a new color AFTER tabbing off of the field. In other words, after selecting the Red Pen (with my button), the text was black as I typed it in, but changed to red as I tabbed to the next field. Is there a way to make the text red as the user types it in?
Raybaudi Posted February 8, 2006 Posted February 8, 2006 yes, it is possible. You have to make two layouts and use a custom function: GetRGB() from Michael Horak. BTW see the attached example Pen.zip
comment Posted February 8, 2006 Posted February 8, 2006 You could try something like this (attached), but it is not perfect. Why not simply let the user use Filemaker's text formating toolbar? Pen.fp7.zip
Raybaudi Posted February 8, 2006 Posted February 8, 2006 Nice job, comment. Nice your use of Get ( ActiveSelectionStart ) !! Trim can't help to eliminate the double spaces... but if the script step becomes: Insert calculated result[TextColor ( "|" ; Get ( ScriptParameter ) )] and there is an autoenter/replace calc: Substitute ( Text; "|" ; "" ) there will be no more double spaces.
comment Posted February 8, 2006 Posted February 8, 2006 Yes, but meanwhile the user is annoyed by a vertical bar that he/she didn't type. At least a double space doesn't stick out so. It would be possible to set the field to auto-enter TrimAll() upon exit - assuming no one would want to enter double space on purpose.
Raybaudi Posted February 8, 2006 Posted February 8, 2006 the use of the vertical bar isn't so bad to look and can make the changes applying INTO the same word too. For example: black tex[color:red]|t red now. becomes ( on field exit) black tex[color:red]t red now.
comment Posted February 8, 2006 Posted February 8, 2006 the use of the vertical bar isn't so bad to look Well, that's a matter of opinion. It certainly isn't mine. One thing is sure, it does not look like a polished, professional solution (and neither does double space).
Raybaudi Posted February 8, 2006 Posted February 8, 2006 Hi comment Now your IDEA is working better (see attachment) ! Real Black and Red text without double spaces !! (it is also good for numbers with 8 digits plus periods, commas and minus sign) Without AutoEnter and still without reference to a particular field ! BTW your profile says Dev 7 and so does mine, but your IDEA will work only with 8 :) Pen.zip
comment Posted February 8, 2006 Posted February 8, 2006 Hmmm... that is strange... I tried that but it didn't work: it kept reverting to the previous color, as if it erased the 'change color' mark. Well, never mind, as long as it works now. Well done. BTW, it can be done in v.7 without a problem. But the number field is problematic. Pen.fp7.zip
Raybaudi Posted February 8, 2006 Posted February 8, 2006 I see... FM7 is even better than 8 (no flash when you change Pen color)...I'm guessing why ! For the number field, it will show colors only if formatted as "General" ( it seems ) And thank you !
Raybaudi Posted February 8, 2006 Posted February 8, 2006 Another improvement... now you can select some words and apply the color. Pen.zip
comment Posted February 9, 2006 Posted February 9, 2006 Ooops, I found a problem: if you place the cursor in the middle of text, the script will "eat" a character. I thought I found a bug, but after reading the help it turns out it's a "feature", so it was my mistake from the start. I have fixed this - see the notes inside the script. Pen.fp7.zip
K1200 Posted February 9, 2006 Author Posted February 9, 2006 WOW! I just checked back in and downloaded the file. What a great solution! This should definitely be put in the Tips & Tricks section. Thanks very much to both of you.
Newbies mklar Posted February 16, 2006 Newbies Posted February 16, 2006 You can also use the same technique to change the font size of selected type! Pen_size.fp7.zip
Recommended Posts
This topic is 7194 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