Jump to content

Script to Automatically change Tab Panel


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

Recommended Posts

  • Newbies

Hello all,

I'm totally new to Filemaker, so I hope you'll bear with me as I try to explain what I'm doing and where I need a little help! As best I can tell, nobody seems to have had a question similar enough to mine for me to apply their solution to my problem.

 

I am trying to script a behavior to automatically change the active Tab on a record, but with a slight twist. I currently have 4 tabs setup that are dynamically generated based on a user's  selection of checkboxes (e.g., if 2 boxes are checked then two of the tabs take that text for their labels and the remaining two tabs are hidden -- solely for the sake of aesthetic design)

 

The problem arises in that, on a record-to-record basis, some have 1 tab, and others have all 4. So if a user navigates from a record with 4 tabs to a record with only 1 (while the 4th tab was active) it makes that 4th tab active on a record where it should not be accessible! As mentioned, I have already worked out how to hide the extra tabs in formatting, and I have it scripted so users cannot click-interact with the tabs, but thus far I have not been able to close this loophole!

 

So I guess I need help writing a script to compare how many Tabs should be active against the highest position one that actually is, and then figuring out how to automatically open the right tab(s).

 

Thanks very much in advance for the assistance!

Link to comment
Share on other sites

Could you provide a little more detail with some examples?  Meaning how would you determine which tab you want to show when navigating from record to record? 

Do you want them in order, meaning:

Always show the lowest number? For example:

Record 1 has tabs 1,3,4--show Tab 1

Record 2 has tabs 2,4--show Tab 2

Record 3 has tabs 3,4--show Tab

etc.

Once that's figured out, then a script attached to an OnRecordLoad may be one way to go.

Link to comment
Share on other sites

  • Newbies

Thanks for the response,

I think my preference would be to show the next "highest" tab

As for examples: Assuming Record 1 has Tabs A, B, & C, if the user switches to Record 2 (with Tabs A & B while the front panel is Tab C then the script should take control to switch the front panel on Record 2 away from the "empty" Tab C panel now being displayed. As the next available tab in this case is Tab B that should become the front panel.

 

One clarification, I used these tabs as procedurally generated "Category" markers. So even though they may have different labels across different records, they still use the same sequential tabs. So there is never a scenario where a record has Tab 2 and 4 as you describe; in the internal logic the label may be "2" and "4", but functionally I'm only using tab 1 & 2, so there is never any "gap".

 

Hope that helps!

Link to comment
Share on other sites

IMHO, it would be convenient to keep the index number of the currently selected tab in a global variable - see: http://www.filemaker.com/help/13/fmp/en/html/func_ref2.32.94.html#1053326

 

Then compare that number with the count of values in the checkbox field; if it's higher, switch to the last tab listed in the checkbox field.

 

 

This is assuming there isn't a better mechanism to achieve whatever your purpose is. I couldn't figure out what "procedurally generated "Category" markers" means, and I suspect a portal might be a much more suitable solution.

Link to comment
Share on other sites

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