Jump to content
Server Maintenance This Week. ×

Tab Control with Form & List layouts


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

Recommended Posts

In an earlier topic, I commented on my experiment with improving the visual appearance of a Tab control. My goal at the time was to mimic the visual appearance of the FM sample databases. While that's certainly possible, for the time being, I've decided I don't want to give up the flexibility of the standard Tab control (e.g., variable number of tabs, automatic tab sizing, easy reordering of tabs).

Since many of my databases are modeled after the FM samples, I found myself faced with clashing tabs, i.e., new FM 8 tabs in the middle of a Form View with old-style graphic tabs near the top ( modeled after the sample databases).

My latest experiment is replacing the old-style graphic tabs with a FM 8 Tab control. I immediately ran into the need for separate layout for Form and List views.

With help from 24U Software's Scripted Tab Control and Softwares for Humans' freeware EventScript plug-in, I've created a prototype of a 3-tab control that includes both a Form layout and a List layout.

Actually, only the Detail and Help tabs are in the Form layout. Clicking on the List tab switches to the List layout, and clicking on Detail or Help switches back to the Form layout.

Update: I attached the first version of my database prototype to this note - don't download it. I've added an improved version to a later note.

-- Ward

TabControl_layouts.zip

Edited by Guest
Add the "Update" comment because I can't remove the attached file from this note.
Link to comment
Share on other sites

Hello Ward! I think this is a very good idea to run a script when the user is going to another tab. For some layouts or some tabs, they are script steps that must absolutely be executed to display correctly the datas.

The way you are triggering the necessary script is different and very clever I think, because you can control everything without the needs to go on the interface to place buttons and/or script parameters on buttons. Everything is managed directly from your calculations fields so it is a 'solution-wide' navigation functionality.

But actually, I think there is a small bug in your EventScript calculation triggers. First, it is a bit dangerous to use script-triggers directly inside a calculation field but I understand it is required in this case to always check for the currently active tab through the use of the Get( CalculationRepetitionNumber ) function.

So the bug I saw when trying your file with the script debugger on FileMaker Advanced 8 is that your triggered script were launch over and over causing kind of infinite loops. Each time the script step 'Go to Layout' is met in a script, then your trigger-calculation reacts and trigger another instance of your target-script.

This is definitely a bad thing !

So I changed your calculation field named "formTab" to :

Let( [

tab = Get( CalculationRepetitionNumber ) ;

$$formTab = If ( tab ≠ 2 ; tab ; $$formTab )

] ;



If ( tab ≠ 2;

   tab ;

   If ( Get ( ScriptName )  ≠ "Go to List" and Get ( ScriptName )  ≠ "Go to Form(tab)";

      S4HU_EventScript( Get ( FileName ) ; "Go to List" ; "" );

      ""

   )

)

)

The If ( Get ( ScriptName ) ≠ "Go to List" and Get ( ScriptName ) ≠ "Go to Form(tab)" part is placed here to prevent multiple launching of either navigation scripts.

And I do a similar change to your "listTab" calculation field.

I guess there is probably a simpler way to do this but you are using repetition fields for tabs# !? I also noticed when everything is debugged, going without the Script debugger gives very strong and quick responses.

Please find my proposed review version with this post.

GF_TabControl_layouts.zip

Link to comment
Share on other sites

The way you are triggering the necessary script is different and very clever I think, because you can control everything without the needs to go on the interface to place buttons and/or script parameters on buttons.

My first thought was to overlay the tabs with invisible buttons. But I wanted the tabs to have normal behavior, e.g., avoid button highlighting.

there is a small bug in your EventScript calculation triggers. ... So the bug I saw when trying your file with the script debugger on FileMaker Advanced 8 is that your triggered script were launch over and over causing kind of infinite loops.

Thanks for discovering this Debug Scripts loop. Inspired by your code change, I found a simpler If expression that avoids the loop:

If ( tab ≠ 2 or Get ( ScriptName ) ≠ "" ; tab ; S4HU_EventScript( Get ( FileName ) ; "Go to List" ; "" ) )

I guess there is probably a simpler way to do this but you are using repetition fields for tabs# !?

The repeating field technique came from 24U Software's Scripted Tab Control. I really like that the tab numbers stay with tabs when the order of the tabs is changed, when a tab is renamed, or when a tab is deleted.

I suspect there's no more elegant way to mimic Go to Tab and Get(ActiveTab).

I've attached an updated version of my database prototype. (It also restores the On Open behavior of resizing the window to the size of the Form layout on both Mac OS X and Windows. Homer had changed it to maximize the window, which is quite shocking on a large Mac OS X monitor.)

-- Ward

TabControl_layouts.zip

Link to comment
Share on other sites

Thanks for discovering this Debug Scripts loop. Inspired by your code change, I found a simpler If expression that avoids the loop:

If ( tab ≠ 2 or Get ( ScriptName ) ≠ "" ; tab ; S4HU_EventScript( Get ( FileName ) ; "Go to List" ; "" ) )

My point Ward is, if 1 or more scripts are already running, then your navigation script won't be triggered if your are checking for the non-execution of all scripts ( GetScriptName)≠"" ).

That's why I take care to specify :

If ( Get ( ScriptName ) ≠ "Go to List" and Get ( ScriptName ) ≠ "Go to Form(tab)";

THEN RUN ONE NAVIGATION SCRIPT

Please find with this post a visual demonstration of what I meant.

- -

I suspect there's no more elegant way to mimic Go to Tab and Get(ActiveTab).

Until FileMaker gives us a true way to know which tab is currently selected and a true way to go to a specific tab, I guess the repeating field trick by 24uSoftware is very efficient.

Maybe in FM8 revision v2, we are going to see these functions because I don't think this is very complex to implement. Along with built-in script triggers maybe !? :

GF_TabControl_layouts_WithMultipleScriptRunning.zip

Edited by Guest
Link to comment
Share on other sites

My goal in simplifying the If expression was to avoid hardcoding the names of all layout-switching scripts in the calculation. I anticipate that in my real FileMaker solution I'll have three or more scripts (and just as many repeating calculations).

While developing the first version of my prototype, I broke it at one point when I made a small change to the name of one of the scripts.

I see a middle ground between all-script-names and no-script names -- check to see if the name of the active script begins with "Go to" (or some other fixed prefix).

I, too, look forward to a native FileMaker solution to controlling the Tab control.

-- Ward

Link to comment
Share on other sites

  • 2 months later...

Ward

Thank you for your work on this topic. It has provided me with inspiration and challenges at the same time! I am a long time fmp user who owned but never used fmp7. Version 8 has enough to force me into the "new era."

I am experimenting with using your technique with more than one list layout option (in otherwords...tab 2 is a list, tab 3 is a list but tabs 1 and 4 are not)....the reason for this is an effort to maintain a look/feel approach for the interface but have list views instead of portals (to utilize the scroll wheel support) among other things.

Have you tried your technique with more than one tab taking you to different list layouts? I have been playing with this without much success (still a newbie on 8)

Greg

Link to comment
Share on other sites

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