14 Replies Latest reply on Jan 22, 2009 9:29 AM by TSGal






      I use both FMP9 and Bento, but am not an expert.  Is there a way to create in FMP9 a checkbox that works and looks like the checkbox field in Bento?


      I can get the checkbox with the "X" to toggle on and off (using a value list with a single value "Yes" ), but it is not nearly as attractive as the checkbox in Bento.

        • 1. Re: Checkbox

          Unfortunately, the short answer is no.


          This is because Bento uses native Mac OS X graphical effects for shadows, transparency and so on. 


          Filemaker does not make use of any modern Mac or Windows specific graphic capabilities and basically has always had the same check boxes, patterns, and so on. You can do some things with color and background but nothing as slick as Bento.


          That said, it is possible to simulate a similar design using a container field as a button that switches between two graphic images when you click it, but it require a little bit of work and you may not think it is worth it in the long run.


          It requires that you store two checkbox images (selected and deselected) in a global containerfield and use a calculated containerfield to display the correct image depending on the value in the text field (which may or may not be visible). This field would also serve as your button.

          You need a script attached to this button to toggle the text field between yes and nothing when you click the container field, thereby switching the graphic.


          • 2. Re: Checkbox

            Thank you.  I created the two images I want to use, but could not figure out how to switch between the two when I clicked them except by creating multiple layouts, which I thought would quickly become unwieldy with multiple checkboxes on a layout.


            I didn't think about a container file.  Thank you for pointing me in the right direction.  I will give that a try.  I don't mind "a little bit of work."





            • 3. Re: Checkbox

              Ok, here are a few more pointers just in case you hit upon a snag.


              The container field needs to be set to global storage so that all records can access it. This is set up in the Storage tab under Options. 

              Also, make it repeating with two repititions so that it can hold both images we need.

              I have called it ContainerField_g in the example below. 


              I assume you have a text field that can contain Yes, some other value or nothing and that this is the criteria we are checking for. I have called it Checkbox_value in the example below. If you don't have such a text field, create it.


              Make a new calculation field that looks something like this:


              Case( Checkbox_value = "Yes" ; ContainerField_g[1] ; ContainerField_g[2])


              Important! Make sure that this is set to return a result of Container in the bottom part of the dialog. 


              This calculation will return the first repetition of the container field if the Checkbox_value field contains Yes and the second repetition for all other values. 


              Next, you need a script that toggles the Checkbox_value field.


              This script could be something like this:


              If [Checkbox_value = "Yes"] 

                 Set Field [Checkbox_value; "No"]


                 Set Field [Checkbox_value; "Yes"]

              End If


              Optionally end the script with a Commit Records step. 


              Now all you need to do is attach this script to your button field. 



              • 4. Re: Checkbox
                   Thank you.  I appreciate your taking the time to explain all that.  I'll let you know how it works out.
                • 5. Re: Checkbox

                  That works like a charm.


                  I didn't realize that a calculation field could be set as a container; that's nice to know.  And your script is more streamlined than the one I had created before your second post.


                  Your solution has helped me more than you know.  I had used a container field instead of a calculation field, so my script set both the container field and the value text field at the same time. However, the graphic and the value were not tied/linked/dependent in any way.  Having the state of the checkbox directly dependent on the value in the text field is such a better design.


                  I realize now that, under my solution, if I had changed the value in the text field in another layout or view (without running my script at the same time), the graphic would not have changed, and would have been incorrect.  Of course, under your design, the graphic will always be correct.


                  Thank you again for your time and expertise.



                  • 6. Re: Checkbox

                    i followed the instructions but can't seem to figure out how to attach the 2 graphics to the button. right now when i click on the field i just get a toggle between text "yes" and "no", and all other fields get highlighted in my user interface also (?) 


                    could you pls describe in detail how this part is set up?


                    and another question: if i duplicate this checkbox and place it before 10 different text fields will checking one box check them all or will they be checked independently?


                    many thx

                    • 7. Re: Checkbox



                      Thank you for your post.


                      The two graphics are put into a global container repeating field.  In the excellent example by "AndreasT", he named this field "ContainerField_g".  (The "g" is added to remind you/developer this is a global field).  Place the check marked graphic in the first repeat, and the unchecked graphic in the second repeat.  This does NOT need to appear on the layout.


                      Next, the text field to hold the values "Yes" and "No" is created.  AndreasT names this field "Checkbox_value".


                      Next, we'll need to display the graphic when we click on a button.  This is done through a calculation field, which AndreasT does not name.  Let's call it "DisplayCheckbox".  The formula is:


                      Case ( Checkbox_value = "Yes" ; ContainerField_g [1] ; ContainerField_g [2] )


                      That is, if Checkbox_value equals "Yes", then we display the image from the first repetition of ContainerField_g.  Otherwise, we display the image from the second repetition of ContainerField_g.


                      Make sure you set the calculation to result in type Container and repeats two times. 


                      Now, we need a way to change the value when we click on the button.  That is, if we click on the graphic with no check, we want it to be checked.  And, if we click on the graphic with a check, we want to change it to not checked.  Therefore, a script needs to be created.


                      Pull down the Scripts menu and select "ScriptMaker" (FileMaker Pro 9) or "Manage Scripts (FileMaker Pro 10).  Create a new script and name it "Toggle Checkbox".  Using the commands on the left side, create the following script steps:


                      If [Checkbox_value = "Yes" ]

                         Set Field [Checkbox_value; "No" ]


                         Set Field [Checkbox_value; "Yes" ]

                      End If



                      When finished, exit ScriptMaker/Manage Scripts.  Pull down the View menu and select "Layout Mode".  Make sure the calculation field "DisplayCheckbox" is present on the Layout.  Click on this field, pull down the Format menu and select "Button Setup..."   From the left side, select "Perform Script", and select the "Toggle Checkbox" script just created.


                      You can now go to Browse mode and click on the graphic to see it toggle on and off.


                      If you duplicate the checkbox and place it before 10 different text fields, then when you check one, you will check them all since they are duplicated.


                      If you have ten independent checkboxes, then you will need ten different "Checkbox_Value" fields, and the ten scripts that mention "Checkbox_Value" will have to refer to the appropriate new "Checkbox_Value" fields.  The "ContainerField_g" does not need to be changed.


                      If you need further clarification, please let me know.



                      FileMaker, Inc. 

                      • 8. Re: Checkbox

                        thank you for the added detail TSGal. i don't have the application in front of me right now, but what i don't get is when you say "The two graphics are put into a global container repeating field....Place the check marked graphic in the first repeat, and the unchecked graphic in the second repeat. "


                        how are the graphics "placed"? i tried various ways of adding the graphics, e.g. dropping them into the layout etc but i somehow am missing how to put 2 graphics into one field. maybe this is real basic stuff but i'm missing something. can you describe? sorry for being dense... 

                        • 9. Re: Checkbox



                          No need for apologies.  Everyone on this forum is in some stage of learning FileMaker Pro, and it is hard for me to determine the knowledge of the user, so sometimes I assume too much and sometimes too little.  Tough to balance without coming across condescending, demeaning, elite, etc.  In any case, this is how you do it.


                          When you create ContainerField_g, make sure you set it for Global Storage and two repetitions as describe originally by AndreasT.  This is very important.


                          Then, put this field temporarily on the layout, and make sure you show two repetitions.  To do this, pull down the View menu and select "Layout Mode".  From either the left side (FileMaker Pro 9 and earlier) or the top (FileMaker Pro 10) of the screen, there will be tools.  Select the Field tool and drag it onto the layout.  When you let go, you are prompted for the field.  Select "ContainerField_g".  With the field still selected, pull down the Format menu and select "Field/Control -> Setup...".  At the bottom, make sure you show repetitions 1 through 2.  The orientation can be either vertical or horizontal, depending on the room on the layout.  You should now see two instances of ContainerField_g.  Return to Browse mode by pulling down the View menu and selecting "Browse Mode".


                          Now, put your cursor in the first ContainerField_g repetition, pull down the Insert menu and select "Insert".  FileMaker will now prompt you for the file you want to insert.  Select the appropriate file.


                          Repeat the same step for the second repetition of ContainerField_g.


                          I think that's it....  Keep me posted if you need further clarification.



                          FileMaker, Inc. 

                          • 10. Re: Checkbox

                            thank you so much TSGal! that did the trick and i now have my checkbox!



                            another question: on my screen layout i used to have as the "default" mask (what the user sees in various data when in browse mode) a tab ('window pane') showing addresses. there are several other 'panes' i can click to reveal more info, such as related contacts, products (where i have my checkboxes btw) etc.


                            originally the layout always showed the addresses. now for some reason it defaults to another tab which i don't want. how did it get switched and how can i return the screen setup to show the addresses pane by default?


                            many thx 

                            • 11. Re: Checkbox

                              hm i just discovered something i wasn't expecting - and which makes the checkboxes pretty much useless... i want to create a set of checkboxes on my product page where i can mark which of our products each customer we have sells. what i found was that if i check one of my boxes off on one client record, then this checkbox becomes checked in each and every one of my (hundreds) of client records' product pane. 


                              what i wanted was to have a checkbox set on the product pane for each client individually, so that the user can mark them easily and has a clear overview of which product that client sells. is this even possible without major advanced programming in FMP?



                              • 12. Re: Checkbox



                                It sounds like your default tab was changed.  Pull down the View menu and select "Layout Mode".  Double-click on the entire tab structure, and in the upper-right corner, it shows the "Default Front Tab".  Use the pop-up below that to set the default tab to the pane that shows the address.


                                As far as your checkboxes showing the same for each record, then you probably set the field "Checkbox_value" to be a global field.  This would result in the same value for every record, where you definitely want individual values for each record.  Go into "Manage -> Database" (File menu), and make sure the storage for "Checkbox_value" is not set to global storage.



                                FileMaker, Inc. 



                                • 13. Re: Checkbox

                                  hi again, actually it was not global, however i checked the others' storage values and i found out the "checkbox_display" (the calculation field WAS. after i disabled this it worked and i now have the checkboxes independent! 


                                  thx so much.


                                  another question: in some view modes of some layouts the "table" view cannot be edited. i only get "modify" as an option and then i can add or edit the display fields i want in that table. for some reason some tables have BOLD columns and others don't. i can't find a way to edit the font styles at all for this. is that normal? why are there some layout modes where some view modes allow to be edited and other views don't? 

                                  • 14. Re: Checkbox



                                    Glad you were able to figure out the checkbox problem!


                                    I don't know why "Table View" cannot be edited.  Where is the "Modify" option displaying?  Which version of FileMaker Pro do you have?  When you say "BOLD columns", are you talking about the field labels or the contents?  If the contents, then you can go into Layout mode and change the field value to Plain Text, Italic, etc.  Whatever you prefer.


                                    I'll need additional/specific information to further help you.



                                    FileMaker, Inc.