Jump to content

How can I attach a button to a container field that prompts user to select an image to be inserted?


This topic is 1451 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have some elderly users that are challenged by doing a right-click on a container field to insert an image. How can I attach a button to the container field so whenever they click on it a dialog pops up that prompts them to select an image from their hard drive?

The users are all on Macs.

Edited by HALBURN
Link to comment
Share on other sites

Put clear button over the entire container field, make sure it's on top.  

A script could branch so if a user has an image in the container field, it can ask to delete or replace, if no image in container field, do the steps to add one.

 

Link to comment
Share on other sites

On 5/2/2020 at 12:24 PM, Steve Martino said:

Put clear button over the entire container field, make sure it's on top.  

A script could branch so if a user has an image in the container field, it can ask to delete or replace, if no image in container field, do the steps to add one.

 

Thanks. The part that I am having trouble with is what script step would prompt the user to select an image from their hard drive? I tried the Insert Image script step (I am not at my computer at the moment) but I think this forces me to select the image when I am defining the script instead of allowing the user to select the image when they execute the script.

 

Edited by HALBURN
Link to comment
Share on other sites

It's insert Picture, not Insert Image. If you don't specify a source file, Filemaker will display a dialog for choosing the file to insert. Note that you must activate the target field before calling this step. 

A better option is to use the Insert File step, that lets you specify the target field (and a few other things). To insert an image, select the Display: • Content of file (when possible) option.

 

Link to comment
Share on other sites

16 minutes ago, comment said:

It's insert Picture, not Insert Image. If you don't specify a source file, Filemaker will display a dialog for choosing the file to insert. Note that you must activate the target field before calling this step. 

A better option is to use the Insert File step, that lets you specify the target field (and a few other things). To insert an image, select the Display: • Content of file (when possible) option.

 

Thanks comment.

It's been a while since I have used FileMaker. I am trying to create a single script that I can use on 10 different container fields. I have given each container field an object name and I am telling the script to go to that object before the "Insert File" step. Unfortunately this is not working. It returns and error [3] Command is not available. Can you please tell me what I am doing wrong?

Link to comment
Share on other sites

1 minute ago, HALBURN said:

Can you please tell me what I am doing wrong?

No, not without seeing the script and the contents of the parameter.

 

11 minutes ago, HALBURN said:

I have given each container field an object name and I am telling the script to go to that object before the "Insert File" step.

Note that with the Insert File script step, you could insert the file into a variable first, then use the Set Field By Name step to pass it to the selected field. This would enable you to perform the entire operation at the data level, without relying on any layout objects.

 

8 minutes ago, HALBURN said:

I am trying to create a single script that I can use on 10 different container fields.

This raises a red flag for me. What is the use for 10 container fields? Shouldn't they be records in a related table instead?

 

Link to comment
Share on other sites

32 minutes ago, comment said:

No, not without seeing the script and the contents of the paramete

This is the script.

image.png.aceda85a76f3e136aa45143d0f43ceae.png

FileMaker Pro Advanced Clipping (2∶36∶08 AM) 3.png

32 minutes ago, comment said:

This raises a red flag for me. What is the use for 10 container fields? Shouldn't they be records in a related table instead?

 

Yes. I am aware. Trust me, there is a reason. :)

Edited by HALBURN
Link to comment
Share on other sites

1 hour ago, comment said:

No, not without seeing the script and the contents of the parameter.

 

Note that with the Insert File script step, you could insert the file into a variable first, then use the Set Field By Name step to pass it to the selected field. This would enable you to perform the entire operation at the data level, without relying on any layout objects.

 

This raises a red flag for me. What is the use for 10 container fields? Shouldn't they be records in a related table instead?

 

Thanks for your help. I ended up brute forcing it with a separate script for each image.

I am getting too old to remember this stuff. :)

 

Link to comment
Share on other sites

8 minutes ago, comment said:

I am afraid I can't detect anything wrong with the script (other than wasting memory on duplicating the script parameter to a variable). At what point do you get the error?

 

On the Insert File step. No worries. I have it working.

Thanks again for you help.

Link to comment
Share on other sites

This topic is 1451 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.