Oyvind Odegard Posted July 24, 2007 Share Posted July 24, 2007 Hi, Great forum! I have a question I hope someone can answer. I have a layout with a TCO with four panes, each pane representing one of four categories. I have four "new record" buttons, one for each category - and a script that shows the relevant pane accordingly. What I would like is to have FM automatically switch to the relevant panes while browsing records. Is this possible? Oyvind Odegard Link to comment Share on other sites More sharing options...
stanley Posted July 24, 2007 Share Posted July 24, 2007 Oyvind: If you use Go To Field[] and specify a field in the relevant pane, it will switch to that pane. -Stanley Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted July 24, 2007 Author Share Posted July 24, 2007 Thank you Stanley, that is a good tip, but how to trigger it for each record? For instance while scrolling in browse mode or within a found set? I'll hide the status area and do my own scripts for navigating, but I'd like to keep the scrolling ability if possible. -Oyvind Link to comment Share on other sites More sharing options...
mr_vodka Posted July 24, 2007 Share Posted July 24, 2007 You will need to use an event plugin. Take a look at Ray's demo for hilighting the active row in list view and see if you can pick it apart. The concept behind its technique will almost be the same. In your case, the triggered script should have it go the the proper tab using Go to Object. http://www.nightwing.com.au/FileMaker/demos8/demo806.html Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted July 25, 2007 Author Share Posted July 25, 2007 Thank you very much! I'll go trough it thoroughly, but at first look it seems to be what I need. I was hoping to avoid installing plug-ins on all clients, but I guess there is no way around it. Cheers Oyvind Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted July 25, 2007 Author Share Posted July 25, 2007 Works like a charm! Thanks again, Oyvind Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 Hi, I guess my last exclamation was a bit premature. I use the zippscript plug-in as you recomended, and control the tabs with to fields. The field "Kategori" is set by a "new record"-script to 1,2 3 or 4 - depending on what kind of record is chosen. The other field "Kat_num" is a calculation field with the following calculation: Let ($Num = Kategori; Case ( $Num=1; zippScript_PerformScript( Get(FileName); "Tabscript1"); $Num=2; zippScript_PerformScript( Get(FileName); "Tabscript2"); $Num=3; zippScript_PerformScript( Get(FileName); "Tabscript3"); $Num=4; zippScript_PerformScript( Get(FileName); "Tabscript4"))) The tabscripts are simple "go to object" scripts. This solution does what it is intended to do, and I always get the correct tab when navigating between records or layouts. The problem is that the "Kat_num" field is recalculated on a seemingly whimsical basis, and very often two,three or four consecutive times (monitored as four instances of "tabscript2" as active scripts in the script debugger). This causes the screen to "flicker" as the layout is re-rendered, and even more irritating causes the cursor to jump out of its active field and go to the first field in the tab order. This happens when changing layouts, tabbing between fields or deleting a record - but not always. The "Kat_num" field is set not to store and recalculate when needed. Seemingly for some reason Filemaker finds it necessary to recalculate when it shouldn't need to. Anybody know what triggers the need to recalculate? Any tips or ideas on how to fix this problem would be much appreciated! Oyvind Link to comment Share on other sites More sharing options...
Vaughan Posted August 30, 2007 Share Posted August 30, 2007 "Seemingly for some reason Filemaker finds it necessary to recalculate when it shouldn't need to." This is often a side-effect of event-triggered scripts: there can be unexpected cascade effects. What does the Tabscript2 script do? Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 tabscript2: Go to object [objectname: "tab2"] You are right. If I disable all other calculated fields in the table it works just fine. Any way around it you think? Oyvind Link to comment Share on other sites More sharing options...
hbrendel Posted August 30, 2007 Share Posted August 30, 2007 Don't use zipscript. Just put script step 'Go to Object (...)' in your navigation script. Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 That won't work if you scroll through records, or if you perform a find will it? Link to comment Share on other sites More sharing options...
Søren Dyhr Posted August 30, 2007 Share Posted August 30, 2007 Couldn't you upload an image of your layout, might it be you're barking up the wrong tree?? --sd Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 There are four tab-panes, the picture shows three of them. I've outlined the tabs with red - they are not visible in the original layout. The DB is an archaeological catalogue btw :) Link to comment Share on other sites More sharing options...
hbrendel Posted August 30, 2007 Share Posted August 30, 2007 That won't work if you scroll through records, or if you perform a find will it? You can script those actions as well. Link to comment Share on other sites More sharing options...
Søren Dyhr Posted August 30, 2007 Share Posted August 30, 2007 I agree with Henk here: http://www.fmforums.com/forum/showtopic.php?tid/189610/post/264591/hl//fromsearch/1/#264591 ...and more specificly it's linkings to this template: http://fmforums.com/forum/attachment.php?attid/8775/ --sd Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 I've been searching the forum now for info on scripting and scrolling records. Could you please point me in the right direction? If it is possible to scroll through records and have the tabs change for each record without using a plug-in it would be great! Thank you for taking time to help me out on this! Link to comment Share on other sites More sharing options...
hbrendel Posted August 30, 2007 Share Posted August 30, 2007 The script would be something like this: Go to record/request/page [next] //or previous or first, or specified nr, whatever Go to object [Object name: "TabNumber" & Database::CatNr] Supposing that 'CatNr' is the field in the file 'Database' where category nrs 1-4 are stored and that your tab objects are named 'TabNumber1', TabNumber2', etc. You can do more things in this script, like skipping records where the user has no permissions, or keeping track what the user does. Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 30, 2007 Author Share Posted August 30, 2007 Ah, I see now that I wrote earlier that I would disable status area and navigate by scripts. As it turns out I need to be able to scroll records using the mouse wheel, hence the need for zippscript to change tabs by calculation. I don't think it is possible to trigger scripts with the mouse wheel (is it?). When I said scrolling earlier, I really ment mouse wheel scrolling. Apologize not being more precise. I still need some advice on the triggerfield recalculating and causing the "go to tab" script stacking up. Appreciate all help so far! Link to comment Share on other sites More sharing options...
hbrendel Posted August 31, 2007 Share Posted August 31, 2007 When you lock the status area, record scrolling will not be possible with the mouse wheel. Record scrolling by mousewheel is not an 'intuitive' computer experience. Don't make it possible. Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted August 31, 2007 Author Share Posted August 31, 2007 I know, but this DB is supposed to replace an existing DB where mouse wheel scrolling is enabled. And the end users specifically asked for it. But I think I have solved the problem now, using the FrontTab function http://www.briandunning.com/cf/692 as a control for whether to run the tabscripts or not: Let ($Num = Kategori; If( $Num = Left(FrontTab;4); ""; Case ( $Num="Tab1"; zippScript_PerformScript( Get(FileName); "Tabscript1"); $Num="Tab2"; zippScript_PerformScript( Get(FileName); "Tabscript2"); $Num="Tab3"; zippScript_PerformScript( Get(FileName); "Tabscript3"); $Num="Tab4"; zippScript_PerformScript( Get(FileName); "Tabscript4")))) And this seems to work just fine. Now I'll just wait for the next pit fall, and call for help again Thanks again! Oyvind Link to comment Share on other sites More sharing options...
Søren Dyhr Posted August 31, 2007 Share Posted August 31, 2007 Evaluate("zippScript_PerformScript( Get(FileName); "Tabscript" & Int($Num) & "")") could replace this: Case ( $Num="Tab1"; zippScript_PerformScript( Get(FileName); "Tabscript1"); $Num="Tab2"; zippScript_PerformScript( Get(FileName); "Tabscript2"); $Num="Tab3"; zippScript_PerformScript( Get(FileName); "Tabscript3"); $Num="Tab4"; zippScript_PerformScript( Get(FileName); "Tabscript4") I've made you a tiny file using this! --sd Oyvind.zip Link to comment Share on other sites More sharing options...
Oyvind Odegard Posted September 3, 2007 Author Share Posted September 3, 2007 Thank you, I will certainly use it! My scripts tend to be long and not very sexy Oyvind Link to comment Share on other sites More sharing options...
Søren Dyhr Posted September 3, 2007 Share Posted September 3, 2007 It's just a matter of choosing the right street, to optain street-credit ... there will most certainly be someone in you near family willing to drop their jaw(s) when you show them your massive Case( --sd Link to comment Share on other sites More sharing options...
Søren Dyhr Posted September 4, 2007 Share Posted September 4, 2007 There is something in this direction, to inspire you further: http://www.briandunning.com/cf/747 --sd Link to comment Share on other sites More sharing options...
fabriceN Posted September 4, 2007 Share Posted September 4, 2007 (edited) sorry for advertising, but I love using LayoutProperties ( http://www.bh-a.com/downloads_1.1.html#DL01 ) to do that, because it makes it easy and secure. The demo file shows how a layout can display two different tabs depending on data (the "Resize to fit" layout changes its behavior if the question mark is on). I use this technique to lock an invoice for example. But as Søren mentions, it would be a shame not to explore the CustomList() function. Edited September 4, 2007 by Guest Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6206 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