Jump to content

Script triggering when clicking a tab


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

Recommended Posts

I understand that FMP10 enables script triggering when clicking an individual tab on a tab panel. In my experiments assigning a script trigger to what I intended to be to a particular tab resulted in that script being applied to all of the tabs.

I've been unable to track down documentation on how to do this. Or else I've been misinformed.

Assistance appreciated.

Link to comment
Share on other sites

I'm looking for a similar solution to a tab control box issue. Like SandyInlet, I'm finding that the tab control box supports only a single set of trigger assignments, and not triggers per tab. That's ok in my opinion if the "Get(ActiveLayoutObjectName)" returned the tab object name that was clicked on. Since you can assign object names to individual tabs you can, if the above GET function returned the object name clicked, direct action within a single script to evaluate the tab being entered and then process different script sections accordingly.

But, in my experimenting, the 'Get(ActiveLayoutObjectName)" is empty when I display it on via the OnObjectModify trigger.

I'd like to be able to apply some security logic to tabs via a script. Yes, you can hodge-podge it by putting a transparent box over the tab you want to limit access to and assigning a script to that object but you can't place the object 100% over the tab. If the object is too low, it becomes part of the tab contents. So, you always have to put it high enough so that there is enough clickable space on the tab just under the transparent object that FM savy people will know about. A script trigger on the tab control object is a much better solution for applying security to a set of tabs.

Anyone have an ideas in this area?

Link to comment
Share on other sites

if the "Get(ActiveLayoutObjectName)" returned the tab object name that was clicked on.

As explained in the other thread, you need to use GetLayoutObjectAttribute().

I'd like to be able to apply some security logic to tabs via a script. Yes, you can hodge-podge it by putting a transparent box over the tab you want to limit access to and assigning a script to that object but you can't place the object 100% over the tab. If the object is too low, it becomes part of the tab contents. So, you always have to put it high enough so that there is enough clickable space on the tab just under the transparent object that FM savy people will know about.

Since version 9, you can disable tabs completely by making their width 0 and applying no border to the tab control object. In previous versions you could do the same by placing another tab control object over the tabs. You then use buttons to select between panels.

Link to comment
Share on other sites

That's true re: 0 width, 0 line tab labels. But, I always wanted to get away from buttons. Just more objects on a layout to manage and I'm a slug.

But, your solution of using GetLayoutObjectAttribute to determine the front tab works perfectly. I've never had reason to evaluate object attributes in scripts until now. Of course, with FM9 it wouldn't have been of much use anyway since you couldn't assign scripts to tab controls. But now that a script trigger spawns a script and the GetLayoutObjectAttribute can show what's essentially just been clicked, it's a pretty neat little solution.

Thanks for posting the sample. It was a big help.

Link to comment
Share on other sites

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