Button Bar - one script & one calculated parameter for entire bar. One calculation for all labels.

Idea created by DavidThorp on Nov 3, 2017
    • Hemant Kumar Patel
    • FredoMkb
    • PeterLauwers
    • DavidThorp

    What do we use button bars for more than anything?  Navigation.  But even if that's not the case, how many times do we have a button bar where every button does the same thing with one minor exception that can be handled by a script parameter?


    So I believe when defining a button bar we should have two options:

    1. Define all buttons individually (this is the current functionality)

    2. Define entire button bar at once.


    If we choose option 2, then we lose the ability to specify whether each button is a popover or button, but we gain all of the following:


    Firstly, be able to select one script to be applied to every button, and then the script parameter for each button should be one of two options:


    a. Simply the button number (and let the called script figure out what to do with it), or

    b. A calculation that can reference the button number.  In that case a new Get ( ButtonBatButtonNumber ) or similar calculation function that only makes sense in the button bar definition window could give us complete flexibility.


    We could enter a parameter something like:


    Choose (

    Get ( ButtonBarButtonNumber ) - 1 ;

    <Parameter for button 1> ;

    <Parameter for button 2> ;




    Or something like:


    GetValue ( "Home¶Clients¶Vendors¶Invoices¶... etc" ; Get ( ButtonBarButtonNumber ) )


    And then the script acts accordingly based on what's passed in.  I think you get the idea.


    Secondly, a similar approach should be applied to the button labels.  Why do I have to click into each button and add the label manually?  Why can't they be calculated -- and be calculated automatically based on one calculation for the entire bar, not a separate calculation for every button?  So again, if option 2 above (Define entire button bar at once) is chosen I can specify one calculation that uses the Get ( ButtonBarButtonNumber ) to calculate all the labels.


    That one calculation could also be something like:


    GetValue ( "Home¶Clients¶Vendors¶Invoices¶... etc" ; Get ( ButtonBarButtonNumber ) )


    as above.


    With that approach, the "Home¶Clients¶Vendors¶... etc" could be stored in a field or global variable somewhere and then that variable passed into both of the above calculations so that a single update to that one variable or field will update the behavior of the button bar entirely.


    But don't limit us just to that calculation.  Maybe we want to draw the labels from records in a table, or any one of a number of other possibilities.  So just add the Get ( ButtonBarButtonNumber ) function, and allow us to specify any calculation we like for the labels -- and the script parameter.


    Thirdly, this philosophy should then be applied to the hide conditions for the buttons in the button bar, and anything else that I haven't thought of that is currently configurable per button.  Anything we can currently configure per button should be configurable for the entire button bar, if Option 2 (Define entire button bar at once) is chosen.


    Also consider:  If the hide condition hides one or more buttons, this should not change the button numbers.  The button numbers are consistent regardless of whether a button is hidden or not.  If button 2 is hidden button 3 remains button 3 and does not become button 2. So then the visible buttons are buttons 1 and 3, such that the Get(ButtonBarButtonNumber) function evaluates to 3 for the second visible button.


    Where some real beauty comes in here is when you add a button to this button bar, it automatically inherits all the behavior of all the other buttons in the bar without having to do anything else.


    I realize one feature of button bars is to allow any of the buttons individually to be chosen as standard buttons or popover buttons.  As noted above, we would lose this functionality when Option 2 (Define entire button bar at once) is chosen, but this functionality should remain if we choose Option 1 (Define all buttons individually).


    If you like this, please upvote!