Jump to content

Recommended Posts

Posted

Howdy all:

For the life of me, I can't figure out how to get this custom function ( https://www.briandunning.com/cf/1943 ) to work. I've attached a rudimentary file where I want to grab the button name and pop it into a global variable. Is the suspect the Get ( ActiveLayoutObjectName ) argument in the calculation, or...?

I'm sure it's something simple, just that I'm in Stupid Mode again. : P

Thanks,

Rich

Test.fmp12

Posted (edited)

If I read your file correctly (I only glanced at it) there are at least two issues here:

1. The custom function requires passing the button bar name. Your button bar does not have a name.

2. Even if the button bar had a name, it would not be returned by Get(ActiveLayoutObjectName).  Clicking a button bar does not make it the active layout object. That can happen only by tabbing into it.


What exactly are you trying to accomplish here? If you want the script to know which button you clicked, you can simply pass the button's name (or any identifying value) as the parameter, without needing all this rigmarole.

 

Edited by comment
Corrected a misconception about timing.
Posted (edited)

I was close--I named the button segments, but not the button.

The goal is simple--I just want to grab the name of the clicked button (segment) so it can be passed to a script and be made into a variable.

Edited by 21st Century Man
Posted
2 hours ago, 21st Century Man said:

I just want to grab the name of the clicked button (segment) so it can be passed to a script and be made into a variable.

And then what? Populating a variable is not a purpose by itself. As I already mentioned, you could simply pass the value of 1, 2 or 3 as the parameter. Then your script will know which button was clicked, without you having to assign object names to them and to the enclosing bar and without an elaborate custom function trying to figure out something which is already known.

 

Posted

It's for navigation purposes between the many layouts in the database. The idea is that with so many layouts and button bars around, there should be one script to handle all the navigation; by assigning variables to pass to the script it would make it easier to code. That's my logic, anyway....faulty as it may be. : P

Posted (edited)
1 hour ago, 21st Century Man said:

there should be one script to handle all the navigation

One script, yes. One parameter, no.

But I am not out to convince you against your will.

 

Edited by comment

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.