Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Continuing in my quest to avoid cut'n'paste scripts...

Is there any way to get the text label of a button in the script that it invokes?

That way you could write one script that behaves appropriately for a large number of buttons, where all you need to do is give it the right label. For example, I could have a script like this:

If [Mod(Status(CurrentModifierKeys), 2)]

SetField(G::HelpText, GetField("HELP " & ?ButtonText?))

Else

# do something else with the field with that name like set a default

End If

Without that, I end up writing a cut'n'paste script for

each and every button.

Thanks.

Posted

Have you considered using a field as a button or as the label on a button?

Sure, but that just puts me into one of the other similar threads... if the script is generic, not specific to the field, then how do you know what field was clicked on or what its contents are? If I could do that, then problem solved. Can I?

Posted

This may help. I made 3 fields, Button, Label, gLabel_Capture. Button is a empty field and transparent. In Label I added some text. gLabel_Capture is a global text field where the contents of Label is to be placed. Set the tab order with Button immediately before Label. Then the following script:

Go to Field["Button"]

Go to Next Field

Set Field["gLabel_Capture","Status(CurrentFieldContnets)"]

Exit Record/Request

This worked until another Button field is placed on the layout. The Go to Field step goes to the first occurance of Button on the layout. It does not look like you can use one script for every button. However, you can make a limited number of scripts to capture several labels. As an example, I am attaching a file with 3 scripts to capture 9 labels.

Hope this helps

Button_Sample.zip

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