buttonbar.getActiveSegmentName ( buttonBarObjectName ; optional_listButtonBarSegments ) ( )

Function stats

Average user rating
496
404
9999
Support
FileMaker 7.0 +
Date posted
10 September 2016
Version
1
Recursive function
Yes

Author Info
 Cristos L-C

7 functions

Average Rating None

author_avatar



 

Function overview

Prototype

buttonbar.getActiveSegmentName ( buttonBarObjectName ; optional_listButtonBarSegments )   ( 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 layout object name of the Button Bar Segment that is active. Useful for determining which button a user clicked.

Examples

Sample input

buttonbar.getActiveSegmentName ( "headerNavigation_ButtonList" ; "" )


Sample output

"CustomerOrders_bbs"

 

Function code

/**

# buttonbar.getActiveSegmentName ( buttonBarObjectName ; optional_listButtonBarSegments )
## v1.0.0 2016-09-07
Returns the layout object name of the Button Bar Segment that is active. Useful for determining which button a user clicked.


## USAGE
buttonbar.getActiveSegmentName ( "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. `"CustomerOrders_bbs"`.


## 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
; ~currentButtonBarSegment /** If we detected the current segment is active, return its name. **/
/** 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.getActiveSegmentName ( ~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/404

    Prototype: buttonbar.getActiveSegmentName ( buttonBarObjectName ; optional_listButtonBarSegments ) ( buttonBarObjectName; optional_listButtonBarSegments )
    Function Author: Cristos L-C (http://www.fmfunctions.com/mid/496)
    Last updated: 10 September 2016
    Version: 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)