Jump to content

Status(CurrentButtonName) ???


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

Recommended Posts

A few people have posted questions to FMforums about how to use multiple buttons to trigger a single script and then have that script take different actions according to which button was clicked.

Currently, there is no Status(CurrentButtonName) function to determine which button triggered the script, but here is another possibility. You can use the following concept to create a dynamic vertical tool bar on your layouts. It's based on the idea of putting buttons in a portal. It's simple. Create a related file with a key field, a button name field and/or a button icon field, other parameter fields, etc. Create a relationship in your main file to the dynamic button file based on MainFile::KeyField = ButtonFile::KeyField. Then, create a portal on the layout in the main file. Insert the button name/icon field from the related file. Create an invisible button over the portal row.

Link the portal button to a script that begins by setting a global field to the key field in the related file. Then the script can perform various actions based on the parameters stored in the dynamic button file.

The key field in the main file can either be a regular text field or a global. The field will have multiple items (one for each button to be displayed) separated by returns, like this:

NewRecord

Link to comment
Share on other sites

  • 5 months later...

I frequently have to deal with this issue. Bob's method seems to be more complicated than necessary and won't work if there are no records in the file. Checking which key is being held down is unavailable in a Kiosk (I think), and requires either a message on a layout or very well trained users. I think the easiest way is with a bunch of 2 line scripts:

SetField(_CurrentButton#, "Button 1")

Perform Script("My Script)

SetField(_CurrentButton#, "Button 2")

Perform Script("My Script")

_CurrentButton# is a global text. For consistency, I always assign the

button the actual name of the button.

Link to comment
Share on other sites

This topic is 7957 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.