1 2 Previous Next 19 Replies Latest reply on May 17, 2011 9:35 AM by philmodjunk

    Copy and Paste (Insert) Picture from Container Field

    TedN

      Title

      Copy and Paste (Insert) Picture from Container Field

      Post

      I am developing a form that has a button. Each time the button is clicked I want a picture on the button to alternate between a check mark or a blank.

      The two images (check mark and blank) are stored in container fields.

      What script would I use to access the the images in the containers and insert them in the button.

      I have put the images in the containers as the form will be located on various other devices, i.e. I can't use a location on my computer as a file source.

      I would normally use check boxes but the appearance of FileMaker Pro checkboxes leaves something to be desired.

      Thank you for any help.

        • 1. Re: Copy and Paste (Insert) Picture from Container Field
          philmodjunk

          The check mark image should be stored in a container field of a related table linked to the table you want to show your two images.

          Define a number field, imageType, in your original table and a matching number field in your related table so you can create this relationship:

          YourTable::imageType = ImageTable::ImageType

          Enter 1 as the image type for the checkbox image in it's ImageTable record.

          Now place ImageTable::ContainerField on the layout for YourTable where you want your button. Use button setup... to use this container field as your button. The button can perform the following step in a script or as a single script step you specify in Button Setup:

          Set Field [YourTable::ImageType ; Not YourTable::ImageType ]

          If YourTable::ImageType is empty or 0 (both evaluate as False), the script will change it to 1 (True) and the check box image will appear. If you click it again, the same step will change it to 0 (False) and as there is no matching record for this value, the field will be empty (blank).

          • 2. Re: Copy and Paste (Insert) Picture from Container Field
            TedN

            Phil,

            Thank you for your reply. I'm totally new at with databases so I have a couple of very basic questions.

            To try out your suggestion I opened a new file called ButtonTest.

            However, when I go into Manage Database I find ButtonTest under the Table Name column. Does that mean a file in databases is referred to as a table. And if so, when you mention the two tables (YourTable and ImageTable), should I be creating two (what I would call) files?

            I also read that to put an image in a container field one right clicks the field, selects Insert, then selects the image to be inserted. I don't see Insert when I right click the container field.

            Thanks,

            • 3. Re: Copy and Paste (Insert) Picture from Container Field
              philmodjunk

              You should create two tables inside the same file. You could create each table inside a different file, but that needlessly complicates this task .

              Go to Manage | Database | Tables and create a 2nd table inside the same file as your original table. That will allow you to then click the Relationships tab and drag from imageType in one table to imageType in the other in order to link the two tables in a relationship.

              PS. You were able to see "ButtonTest" in Manage | Database | Tables because FileMaker automatically creates a table with the same name as the file each time you create a new database file. Thus, you had a new database file and in it was a new database table of the same name.

              • 4. Re: Copy and Paste (Insert) Picture from Container Field
                TedN

                OK, I now have two tables - ImageTable and YourTable.

                In ImageTable I have a container called ContainerField and a number field called imageType.

                In YourTable I have a number field also called imageType. I have related the two number fields.

                "Enter 1 as the image type for the checkbox image in it's ImageTable record." Where do I do that.

                "Now place ImageTable::ContainerField on the layout for YourTable where you want your button." Am I to move ContainerField from ImageTable to YourTable or create another container field in YourTable.

                I'm still having a problem inserting picture in ImageTable::ContainerField. When I select ContainerField and Insert - Picture the picture doesn't appear to be "embedding" in the container.

                Thank you for your assistance.

                • 5. Re: Copy and Paste (Insert) Picture from Container Field
                  JamesRoland

                  Howdy,

                  When you created the ImageTable, a layout is also created where you can create a new record for the image. I just tried this and it works like a charm! :) I made one change in that I inserted a different image for the "0" state; now it toggles between the two images.

                  Thanks Phil! :)

                  Cheers!

                  Lyle

                  • 6. Re: Copy and Paste (Insert) Picture from Container Field
                    TedN

                    Lyle,

                    Could you post a small fmp file which shows what you did. That would be a great help in my understanding this.

                    Thanks,

                    • 7. Re: Copy and Paste (Insert) Picture from Container Field
                      philmodjunk

                      "Enter 1 as the image type for the checkbox image in it's ImageTable record." Where do I do that.

                      Go to the layout for ImageTable. Create a new record if the table is empty.

                      Enter 1 into the ImageType field and then insert or paste the checkbox image you want into the container field.

                      Am I to move ContainerField from ImageTable to YourTable or create another container field in YourTable.

                      Go To the layout for YourTable. Enter layout mode. Use the Field Tool at the top of the screen to add a new field to your layout. Select ImageTable from the drop down in the specify field dialog that pops up. Then select the container field so that you have now added the container field from ImageTable to the Layout for YourTable.

                      When you insert the picture. What options are you selecting when you insert the picture?

                      What is the file format of the image you are inserting?

                      (And you can copy and paste here instead if you prefer.)

                       

                      • 8. Re: Copy and Paste (Insert) Picture from Container Field
                        TedN

                        Thanks Phil. I've done all you suggested but the button isn't showing the image (gif). I'm obviously doing something wrong.

                        Would you mind replying with an FMP file insert which has a button that changes image when clicked. The most basic examples would be fine.

                        I think I could then determine the process.

                        Many thanks.

                        • 9. Re: Copy and Paste (Insert) Picture from Container Field
                          philmodjunk

                          Here you go:  http://www.4shared.com/file/jsfCchWN/RelatedContainerImage.html

                          I've included explanations on both layouts.

                          Feel free to ask questions if there is some part of the file that you don't understand.

                          • 10. Re: Copy and Paste (Insert) Picture from Container Field
                            JamesRoland

                            @TedN - here is another one to take a look at. I have created a script for the "button" (Container field)

                            http://www.4shared.com/file/AeHpUJ8Y/ImageToggle.html

                            @Phil - thanks for the tip and also for where to share files like this :)

                            • 11. Re: Copy and Paste (Insert) Picture from Container Field
                              philmodjunk

                              There are many sites where you can share files.

                              I find I can't wholeheartedly recommend 4shared. They have had some major glitches recently when I tried to update a previously uploaded file without changing the download link and they allow some fairly objectionable Ad links to appear on the download page. Some are deceptive links that look like the download link, but aren't and sometimes an add appears as a picture that while not X-Rated, isn't the "family friendly" type of image you'd want your boss to see when walking by your desk, nor would you want your family to see if you were downloading from home...

                              I haven't stopped using them mainly because I have used it so heavily at this point, that moving my stuff to a different site could break numerous download links that I've posted throughout this forum.

                              • 12. Re: Copy and Paste (Insert) Picture from Container Field
                                TedN

                                Phil,

                                When I click the button I get an alternating 1 and 0 but no image. I notice that in your example in YourTable in Browse Mode, Table View, you show two fields - ImageType and ::Image.

                                I only show ImageType. I assume ::Image is the Container from ImageTable.

                                I've looked all through your example and for the life of me I can't see what I'm missing.

                                What do I need to do to show ::Image in YourImage table.

                                 

                                Thanks,

                                • 13. Re: Copy and Paste (Insert) Picture from Container Field
                                  philmodjunk

                                  ImageType can be removed from the layout. You just need image. I included ImageType for demonstration purposes only. (A script and a button setup turns the container field into a button that performs a script to toggle the imagetype field between 1 and 0.)

                                  • 14. Re: Copy and Paste (Insert) Picture from Container Field
                                    TedN

                                    I'm totally confused now. If I don't have a field called ImageType in the YourTable how can I set up the relationship between two ImageType fields.

                                    Also, I've tried adding a field called ::Image in YourTable and I get an warning message saying I shouldn't use :: in the name.

                                    Oh boy. I think I'll go back to spreadsheets Yell

                                    1 2 Previous Next