buttonbar.getActiveSegmentContent ( )

Function stats

Average user rating
496
403
9999
Support
FileMaker 7.0 +
Date posted
10 September 2016
Last updated
10 September 2016
Version
Recursive function
Yes

Author Info
 Cristos L-C

7 functions

Average Rating None

author_avatar



 

Function overview

Prototype

buttonbar.getActiveSegmentContent  ( buttonBarObjectName;   optional_listButtonBarSegments )


Parameters

buttonBarObjectName  The name (from the Inspector) of the Button Bar layout object.


optional_listButtonBarSegments  Used for recursion, generally should be omitted (see "USAGE" section).


Description

Tags:  button bar  

Returns the text label (i.e., `content`) of the Button Bar Segment that is active. Useful for determining which button a user clicked.

Examples

Sample input

buttonbar.getActiveSegmentContent ( "headerNavigation_ButtonList" ; "" )


Sample output

"Customer Orders"

 

Function code

/**

# buttonbar.getActiveSegmentContent ( buttonBarObjectName ; optional_listButtonBarSegments )
## v1.0.0 2016-09-07
Returns the text label (i.e., `content`) of the Button Bar Segment that is active. Useful for determining which button a user clicked.


## USAGE
buttonbar.getActiveSegmentContent ( "headerNavigation_ButtonList" ; "" )


## PARAMETERS
### buttonBarObjectName
- The name (from the Inspector) of the Button Bar layout object.
### optional_listButtonBarSegments
- Used for recursion, generally should be omitted (see "USAGE" section).


## RETURNS
- The text label given to the button bar segment, e.g. `"Customer Orders"`.


## REQUIRES
- Button Bar must have a name in the Inspector
- Each Segment of the Button Bar must have a name in the inspector


## CHANGELOG
### [2016-09-07 cristos@anchorbuoysoftware.com](http://www.anchorbuoysoftware.com)
- Function created
- Based on suggestions from https://fmslug.slack.com/archives/general/p1473279629000181 by [Tony White](http://www.twdesigns.com)

**/

Let (
[ ~buttonBar = buttonBarObjectName
; ~listButtonBarSegments = Case
    (    IsEmpty ( optional_listButtonBarSegments )
    ;        GetLayoutObjectAttribute ( ~buttonBar ; "containedObjects" )
    /**    ELSE **/
    ;        optional_listButtonBarSegments
    )

;    ~currentButtonBarSegment = GetValue ( ~listButtonBarSegments ; 1 ) /** Get the top-most segment in the list. **/
;    ~isActiveSegment = GetLayoutObjectAttribute ( ~currentButtonBarSegment ; "isActive" )

;    ~value = Case
    (    ~isActiveSegment
    ;        GetLayoutObjectAttribute ( ~currentButtonBarSegment ; "content" ) /** If we detected the current segment is active, return its contents. **/
    /**    ELSE **/
    ;        Let (    /** Otherwise, reduce the list and recursively try again. **/
            [    ~countButtonBarSegments_next = ValueCount ( ~listButtonBarSegments ) - 1
            ;    ~listButtonBarSegments_next = RightValues ( ~listButtonBarSegments ; ~countButtonBarSegments_next )
            ;    ~value = Case
                (    ~countButtonBarSegments_next > 0
                ;        buttonbar.getActiveSegmentContent ( ~buttonBar ; ~listButtonBarSegments_next )
                /**    ELSE **/
                ;        "? - No active button bar segment could be found."
                )
            ]
            ;    ~value
            )
    )
]
;    ~value
)

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

    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/403

    Prototype: buttonbar.getActiveSegmentContent( buttonBarObjectName; optional_listButtonBarSegments )
    Function Author: Cristos L-C (http://www.fmfunctions.com/mid/496)
    Last updated: 10 September 2016
    Version: 1.1

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

 

 

 

 

 

 

 

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)