ZEROmedia Posted November 9, 2005 Posted November 9, 2005 (edited) Again, im a newbee with FileMaker, but I do have some basic programming skills. What I'd like to do is: - I have a to-do-list in which when you've completed a task you click on a checkbox. - When the checkbox is clicked I would like the background to turn to grey. How would I create the code for this to happen? I assume that I would create a script then link the checkbox to the script, but I'm not exactly sure what I should be doing with the script... Edited November 9, 2005 by Guest
Kent Searight Posted November 10, 2005 Posted November 10, 2005 There's no way to change the background color of the checkbox field itself via script or calculation but you could create a calculation field whose result is a container. You could place this behind the transparent checkbox field to give the impression that the field background has changed. Your calculation would go something like: Case(Not IsEmpty(checkBoxField) ; grayGraphicField_g ) whereas grayGraphicField_g is a global container that holds a gray graphic. Your calculation would return that gray graphic when a value is in checkBoxField. Make sense? Hope this helps!
ZEROmedia Posted November 10, 2005 Author Posted November 10, 2005 Thanks for your reply Kent_S, but im not sure if i understand.. Let me explain what i've done so far and my thoughts: - I've settup a checkbox called: Completed - I've settup a field for the background called: CompletedBackground - Now im thinking it should work when the checkbox is ticked the script will work like this: iF (Table::Completed = 1) ---> Then Table::CompletedBackground will appear (I have no idea how to code this) End If Also, how do i make the feild invisible? so when the checkbox is not ticked the 'CompletedBackground' is invisible. If anyone has ideas on how to make this work, or to spell out exactly how the code works that would be great. Thanks!
dwins Posted November 10, 2005 Posted November 10, 2005 (edited) 1. Create a global container field. Place it anywhere on layout. 2. Create a calculation field. Set it to Container. Position and size it for your background. Kent S. gave formula. I'll rewrite: Case ( not IsEmpty( checkboxfield ) ; globalcontainerfield ). 3. While in Layout View draw a rectangle the size and color of your background. Cut it to clipboard. 4. Go to Browse View and paste the rectangle into the global container field. You can then remove that field, and drawn rectangle, from layout. You're done. Edited November 10, 2005 by Guest
Kent Searight Posted November 10, 2005 Posted November 10, 2005 ...spell out exactly how the code works that would be great. The Case() function can be used in place of the If() function. I tend to use Case() more than If() simply because it's a bit more versatile. Basically, with If() or Case(), the logic goes as follows: Case ([if this is the case] ; [do this] ; [if not the case, then default is this]) The comments in brackets [ ] are only to show you the logic and how it works. Note that after the 2nd semi-colon is the default. If you don't want anything to happen, this can be omitted, as in the example I gave you. FileMaker Help explains this in greater detail...just do a search in Help for "If" or "Case". Hope this helps!
dwins Posted November 10, 2005 Posted November 10, 2005 (edited) While the above technique is one you should master as it can be adapted for many uses, here, for fun, is an even simpler technique. Create one calculation field, set to text, with a formula similar to this: Case( not IsEmpty(checkboxfield);"||||||||||||||||||||||||||||||||||||||||||||||||||||||"). You could also name the field ||||||| to help alignment. Now set the font big, bold and colored, and copy the field as many times as it takes to plaster up a solid mass of background. Depending on font, about six staggered copies will fill the gaps horizontally. Group it and stack the groups vertically to fill your space. Edited November 10, 2005 by Guest
ZEROmedia Posted November 10, 2005 Author Posted November 10, 2005 1. Create a global container field. Place it anywhere on layout. 2. Create a calculation field. Set it to Container. Position and size it for your background. Kent S. gave formula. I'll rewrite: Case ( not IsEmpty( checkboxfield ) ; globalcontainerfield ). 3. While in Layout View draw a rectangle the size and color of your background. Cut it to clipboard. 4. Go to Browse View and paste the rectangle into the global container field. You can then remove that field, and drawn rectangle, from layout. You're done. Ok, that helps but i still can't get there.. Step 1 is fine, Step 2 im having some issues - what do you mean by calculation feild and set it to container? Im assuming that i creat a feild thats a container and then add the calculation to that feild in the options? This is what i've done: 1. Created the Global container field (called: GlobalContainer) 2. Created a container feild (called: CompletedBackground) and set a calculation in the options. Here's the calculation: Case ( not IsEmpty ( Completed ) ; CompletedBackground ) Note: Completed is the checkbox 3. Created a white background and cut it to my clibboard 4. Pasted the white background into the container feild.. Nothing seems to happen... im just not sure. Any ideas what im doing wrong? Thanks guys, your continued support is much appreciated.
-Queue- Posted November 10, 2005 Posted November 10, 2005 You want a calculation field with a container result, not a container field with an auto-enter calculation.
ZEROmedia Posted November 10, 2005 Author Posted November 10, 2005 (edited) Ok i've done that change.. but it still doesn't seem to work? What im a doing wrong here? Edited November 11, 2005 by Guest
dwins Posted November 11, 2005 Posted November 11, 2005 When I said create a rectangle the color of your background, I ment the color that you want to change to when you x the checkbox. If you want the background to change to gray when you click the checkbox, make that rectangle gray and paste it into the global container. Look at the formula. It says when the checkbox is not empty, ie checked, it then shows what is in the container field, which will be the gray rectangle object.
ZEROmedia Posted November 11, 2005 Author Posted November 11, 2005 Thanks dwins - that makes allot of sense. I understand the process now. and it works perfectly now! Thanks to everyone thats helped.
Recommended Posts
This topic is 6954 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