isFrontMostTabPanel ( )

Function stats

Average user rating
37
97
9999
Support
FileMaker 8.5 +
Date posted
05 December 2008
Last updated
15 May 2009
Version
Recursive function
No

Author Info
 Fabrice

74 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

isFrontMostTabPanel  ( _objectName )


Parameters

_objectName  


Description

Tags:  Layout Objects   Layout  

Retuns 1 if _objectName is or contains the frontmost tap panel, else 0.

Examples

Sample input

isFrontMostTabPanel ( aTabName )


Sample output

1

 

Function code

/* isFrontMostTabPanel ( _objectName )

by Fabrice Nordmann
http://www.bh-a.com

v.1, Dec 2007

Retuns 1 if _objectName is or contains the frontmost tap panel, else 0.

Based on Agnès Barouh's CustomList ( http://www.briandunning.com/cf/747 )

NOT RECURSIVE
*/



Let ([ $x = _objectName

; $EON = $x & ¶ &
/* #################### LIST OF ENCLOSING OBJECTS ######################## */
Let ( [
start = 1
; end = ValueCount ( LayoutObjectNames ( Get ( FileName ) ; Get ( LayoutName )))
; function = "case ( not isempty ( $x ) ; getlayoutobjectattribute ( $x ; \"enclosingobject\" ) & let([ $x = getlayoutobjectattribute ( $x ; \"enclosingobject\" )];\"\"))"

// Number List : --------------- Create numeric list -------------------

; NumCalc = Substitute ( ( 10 ^ 33 ) -1; "9"; "100100100" ) ;
List1_99 = Substitute ( "_00" & NumToJText ( Left ( NumCalc * NumCalc ; 295 ) ; 1 ; 0 ) ; ["," ; "_"] ; ["." ; "_"] ) ;
$List100_199 = "_100" & Substitute ( List1_99 ; ["_0" ; "_1"] ) ; // (local variable makes it faster in a looped script )
EndMax = LeftWords ( List1_99 & $List100_199 & "_200" ; Int ( ( End - 100 ) / 100 ) + 1 ) ;
FinalList = MiddleWords ( List1_99 & Evaluate ( Substitute ( "(\"_" & EndMax ;
[ "_"; ( "|Substitute( $List100_199 ; \"_1\"; \"_" ) ] ; [ "|"; "\") & "] ) & "\")" ) ; Start ; End - Start + 1 ) ;

//----------------------------- End Create numeric list -----------------

FunctionR = Substitute ( Function ; "[n]" ; "Num" ) ;

// Execute : Create the function string to be evaluated

Execute = Case ( not IsEmpty ( Function ) ;
Case ( Left ( Substitute ( Lower ( Function ) ; ["Define" ; "Let" ] ; [" " ; ""] ; ["¶" ; ""]) ; 5 ) = "Let([" ; // If it's a Let()
Substitute ( "Let([Num=" & FinalList & "|" ; [ "_"; "|¶Let([Num="] ; [ "|";
";" & Replace ( FunctionR ; 1 ; Position ( FunctionR ; "[" ; 1 ; 1 ) ; "" ) & "&\"^|^\"&"] ) ;
Substitute ( "Let([Num=" & FinalList & "|" ; [ "_"; "|¶Let([Num="] ; [ "|";
"];" & FunctionR & ")&\"^|^\"&"] ) ) ) ;

// X - Set the number of "packs" to work around the Evaluate limitation

X = Int ( End / 1700 ) ;

// Result : if "Function" parameter is empty, result is numeric list

Result = Substitute ( "^" & Case ( IsEmpty ( Function ) ; Substitute ( "_" & FinalList ; ["_00" ; "¶"] ; [ "_0" ; "¶"] ; [ "_" ; "¶"] ) ;
Evaluate ( MiddleValues ( Execute ; 1 ; 1700 ) & "\"\"") &
Case ( X >= 1 ; Evaluate ( MiddleValues ( Execute; 1701; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 2 ; Evaluate ( MiddleValues ( Execute; 3401; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 3 ; Evaluate ( MiddleValues ( Execute; 5101; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 4 ; Evaluate ( MiddleValues ( Execute; 6801; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 5 ; Evaluate ( MiddleValues ( Execute; 8501; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 6 ; Evaluate ( MiddleValues ( Execute; 10201; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 7 ; Evaluate ( MiddleValues ( Execute; 11901; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 8 ; Evaluate ( MiddleValues ( Execute; 13601; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 9 ; Evaluate ( MiddleValues ( Execute; 15301; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 10 ; Evaluate ( MiddleValues ( Execute; 17001; 1700 ) & "\"\"" ) ; "" )) & "^"
; [ "^|^"; "¶" ] ; [ "¶"; "¶^" ] ; [ "^¶"; "" ] ; [ "¶^"; "¶" ] ; [ "¶^" ; "" ] ; [ "^" ; "" ] )

] ;
Result
)
; $IFTP =
/* #################### LIST OF FRONT TAB PANELS ######################## */
Let ( [
start = 1
; end = ValueCount ( $EON )
; function = "let([ $o = getvalue ( $EON ; [n] )]; getlayoutobjectattribute ( $o ; \"isFrontTabPanel\" ))"

// Number List : --------------- Create numeric list -------------------

; NumCalc = Substitute ( ( 10 ^ 33 ) -1; "9"; "100100100" ) ;
List1_99 = Substitute ( "_00" & NumToJText ( Left ( NumCalc * NumCalc ; 295 ) ; 1 ; 0 ) ; ["," ; "_"] ; ["." ; "_"] ) ;
$List100_199 = "_100" & Substitute ( List1_99 ; ["_0" ; "_1"] ) ; // (local variable makes it faster in a looped script )
EndMax = LeftWords ( List1_99 & $List100_199 & "_200" ; Int ( ( End - 100 ) / 100 ) + 1 ) ;
FinalList = MiddleWords ( List1_99 & Evaluate ( Substitute ( "(\"_" & EndMax ;
[ "_"; ( "|Substitute( $List100_199 ; \"_1\"; \"_" ) ] ; [ "|"; "\") & "] ) & "\")" ) ; Start ; End - Start + 1 ) ;

//----------------------------- End Create numeric list -----------------

FunctionR = Substitute ( Function ; "[n]" ; "Num" ) ;

// Execute : Create the function string to be evaluated

Execute = Case ( not IsEmpty ( Function ) ;
Case ( Left ( Substitute ( Lower ( Function ) ; ["Define" ; "Let" ] ; [" " ; ""] ; ["¶" ; ""]) ; 5 ) = "Let([" ; // If it's a Let()
Substitute ( "Let([Num=" & FinalList & "|" ; [ "_"; "|¶Let([Num="] ; [ "|";
";" & Replace ( FunctionR ; 1 ; Position ( FunctionR ; "[" ; 1 ; 1 ) ; "" ) & "&\"^|^\"&"] ) ;
Substitute ( "Let([Num=" & FinalList & "|" ; [ "_"; "|¶Let([Num="] ; [ "|";
"];" & FunctionR & ")&\"^|^\"&"] ) ) ) ;

// X - Set the number of "packs" to work around the Evaluate limitation

X = Int ( End / 1700 ) ;

// Result : if "Function" parameter is empty, result is numeric list

Result = Substitute ( "^" & Case ( IsEmpty ( Function ) ; Substitute ( "_" & FinalList ; ["_00" ; "¶"] ; [ "_0" ; "¶"] ; [ "_" ; "¶"] ) ;
Evaluate ( MiddleValues ( Execute ; 1 ; 1700 ) & "\"\"") &
Case ( X >= 1 ; Evaluate ( MiddleValues ( Execute; 1701; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 2 ; Evaluate ( MiddleValues ( Execute; 3401; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 3 ; Evaluate ( MiddleValues ( Execute; 5101; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 4 ; Evaluate ( MiddleValues ( Execute; 6801; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 5 ; Evaluate ( MiddleValues ( Execute; 8501; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 6 ; Evaluate ( MiddleValues ( Execute; 10201; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 7 ; Evaluate ( MiddleValues ( Execute; 11901; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 8 ; Evaluate ( MiddleValues ( Execute; 13601; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 9 ; Evaluate ( MiddleValues ( Execute; 15301; 1700 ) & "\"\"" ) ; "" ) &
Case ( X >= 10 ; Evaluate ( MiddleValues ( Execute; 17001; 1700 ) & "\"\"" ) ; "" )) & "^"
; [ "^|^"; "¶" ] ; [ "¶"; "¶^" ] ; [ "^¶"; "" ] ; [ "¶^"; "¶" ] ; [ "¶^" ; "" ] ; [ "^" ; "" ] )

] ;
Result
)
];
PatternCount ( $IFTP ; 1 ) = ValueCount ( $IFTP )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/97

    Prototype: isFrontMostTabPanel( _objectName )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 15 May 2009
    Version: 1.2

*/
// ===================================

 

Comments

jantunes
05 December 2008



I use that all the time. Thanks for the tip!
  General comment
Eric
06 January 2009



beau travail Fabrice (Agnès)
ça fonctionne...
...il me semble que la fonction existe en natif en version 9 :
ObtenirAttributObjetModele ("nom panneau";"EstPanneauOngletsAvant")
  General comment
Fabrice
06 January 2009



Hi Eric, and thanks.
the native "isFrontMostTabPanel" attribute will only tell you if a tab is selected among the other tabs of its panel, as opposed to this function that tells you if the tab is the frontMOST.
By the way, even if a comment in French is always nice to read, I would recommand to use English while using those object attributes, because "EstPanneauOngletsAvant" will work only with the French version of FileMaker while the original version will work anywere.
  General comment
Eric
06 January 2009



"coucou" Fabrice
Fabrice salvation
can you please explain with an example the difference
Shakespeare or Molière ?
PS :    
in the function and there is a "&" at the beginning and a return here That FM doesn't like
"Let ([ $x = _objectName

; $EON = $x here ¶ &...."
  General comment
Fabrice
06 January 2009



Thanks Eric, typo fixed.
Now, suppose you have a tab control with tabs A and B.
In A, another tab A1, A2.
In B, another tab B1, B2.
Now select B, then B2, then A, then A1 for example.
A, A1, and B2 are "isFrontTabPanel"
only A and A1 are "isFrontMostTabPanel"
In other words, this function tels you if a tab is selected and visible by user.
  General comment
Eric
06 January 2009



Ok I understand.this fonction includes nested tabs
thanks
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)