Jump to content
Sign in to follow this  
Oyvind Odegard

Browse records with tabs

Recommended Posts

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

Share this post


Link to post
Share on other sites

Oyvind:

If you use Go To Field[] and specify a field in the relevant pane, it will switch to that pane.

-Stanley

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

"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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Don't use zipscript. Just put script step 'Go to Object (...)' in your navigation script.

Share this post


Link to post
Share on other sites

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 :)

Layout_upload.jpg

Share this post


Link to post
Share on other sites

That won't work if you scroll through records, or if you perform a find will it?

You can script those actions as well.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :bang:

Thanks again!

Oyvind

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by Guest

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.