Jorgitopeter Posted September 25, 2012 Posted September 25, 2012 Hi everyone, thanks in advanced for your help. I want to go to a specific tab when the word "anticipo" is included in a field. I mean: I have the field "Name" and in the same record, I have two tabs called "anticipo" and "Date". I'd need that if the value of the field "name" is, for example, "John Anticipo Martinson", the "anticipo" tab be shown. If the name is "John Einstein" (and it hasn't any "anticipo" in it), the "Date" tab be shown. I set a scriptrigger on tabswitch: if [PatternCount(name; "anticipo")] go to object [object name: "anticipo"] else go to object [object name: "Date"] end if But when I click in the wrong tab, the wrong tab is shown, and the script triggered isn't avoiding it. Example: althought the name is, for example, "Gcias. Sociedades - Anticipo 5", if I click on "date" tab, that date tab is shown? What should I do to keep the user out from the wrong tab? I attach a sample file Thanks a really lot for the hand!!! PS: I apologize for my bad English. I'm from Argentina. Estudio (1) Copy.zip
Fitch Posted September 25, 2012 Posted September 25, 2012 If you don't want your users to click tabs, you should hide them: give your tab panel a line width of 0, and in the tab settings, set the tab width to 0. Also: please update your profile, it says FM9, which didn't have script triggers. What version are you using?
johndwalton2012 Posted October 17, 2012 Posted October 17, 2012 JorgitoPeter, I have reattached the file for you in the state that you would like. This is a tough issue that I solved some time back. It involves a somewhat complicated interplay between the elements on the layout. You will note that I have removed all formatting from the tabs and set some conditional formatting on the Tab Headers - this allows for the tabs to be shown in Design View, but not in any other view. You will also not the NixSelection script, that will cancel any navigation on the Tab Control that does not come from a script source. Finally, you will not that each of the the other controls have been named, and the select_right_tab applied to their OnObjectEnter script trigger - the name of the control is passed as an argument so that the select_right_tab script can place the focus right back where it started from. Finally, in the select_right_tab has steps placed before and after your script steps - they are there to place the focus back on where the script was started, and to prevent a never-ending loop. Fitch isn't far off the mark above, but setting the tab width to zero make other developer's job a nightmare - please avoid that practice at all costs, conditional formatting properly applied will do the same thing and make future development and maintenance much simpler. Please feel free to ask any questions that you might have about this solution. Estudio_1_Updated.zip
Fitch Posted October 24, 2012 Posted October 24, 2012 Nice job, John. I like your use of the OnTabSwitch script trigger. That is a nice new feature of FileMaker 12. Downloading the original file, I now see that Jorgi is on FM12. For those still on earlier versions, conditional formatting cannot be applied to tab objects. What you can do is conditionally format a text object, so you can leave a "developer note" on the layout that says, "hey, there are hidden tabs here!" I would also recommend that, rather than changing the tabs' text color to white, use the More Formatting button and set the text size to some large number, e.g. 222. This makes the text expand outside of its bounding box and become truly hidden.
Recommended Posts
This topic is 4481 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 accountSign in
Already have an account? Sign in here.
Sign In Now