1 2 Previous Next 17 Replies Latest reply on Jul 1, 2017 10:06 PM by arjen.evertse

    Button Bar active segment with Slider?

    ezeitgeist

      Is there a way to make different buttons in a Button Bar the active segment depending on the slide number/slide object name on a layout? I have a layout where 5 of 6 of the buttons on the Button Bar just jump to a different slide on the same layout.

        • 1. Re: Button Bar active segment with Slider?
          arjen.evertse

          1: Specify a name for each of your panel, say Panel1, Panel2 etc

          2: Specify a name for each button in the button bar, say Button1, Button2 etc

          3: Choose calculation for the active button setting and specify something like:

           

          Case (

           

          GetLayoutObjectAttribute ( "Panel1" ; "isFrontPanel" ) ; "Button1" ;

          GetLayoutObjectAttribute ( "Panel2" ; "isFrontPanel" ) ; "Button2" ;

          etc )

           

          You might need to name the button bar as a whole and use a Refresh object step for the whole button bar in any script that can bring another panel to the front without using the related button.

          1 of 1 people found this helpful
          • 2. Re: Button Bar active segment with Slider?
            philmodjunk

            You could simplify that a lot with a script that updates a global variable with the name or number of the panel that moves to the front. The script can be performed by the OnPanelSwitch trigger. There's a get function that will tell you the object name and number of the panel that will be the front panel once the panel switch event has been processed.

            • 3. Re: Button Bar active segment with Slider?
              ezeitgeist

              So I understand: "Panel1" is replaced with first slide name; "isFrontPanel" stays and is code for active segment; "Button1" is replaced with the button name?

              • 4. Re: Button Bar active segment with Slider?
                arjen.evertse

                True, I'm actually aware of the trigger and the get function it just didn't come to my mind. Your way is actually better since many actions even Go to Field or Go to Object could trigger the panel switch meaning an OnPanelSwitch triggered script would be required anyway.

                 

                Either way, the Refresh Object is required to change the active button unless it was clicked directly.

                • 5. Re: Button Bar active segment with Slider?
                  arjen.evertse

                  Yes, isFrontPanel returns 1 if the panel tested for is the one in front. However, the second method described by Phil is better.

                  • 6. Re: Button Bar active segment with Slider?
                    ezeitgeist

                    If I use the:

                     

                    Case (

                     

                    GetLayoutObjectAttribute ( "Panel1" ; "isFrontPanel" ) ; "Button1" ;

                    GetLayoutObjectAttribute ( "Panel2" ; "isFrontPanel" ) ; "Button2" ;

                    etc )

                     

                    technique, does the last one have a ";" or no ";"? [seems to be working with an ending ";" but would like to do it right.]

                     

                    Also, trying it and two of the buttons in the button bar are drop-downs and when clicked, the slides opened in the drop-down buttons do not show the active button like the others.

                    • 7. Re: Button Bar active segment with Slider?
                      ezeitgeist

                      arjen seems to agree with you, phil, to use a global variable. How exactly do I set that up? I understand to create a gButtonSelect (or the like), but how exactly to I set the global variable to be the front button and how do I use the get function in the trigger script?

                      • 8. Re: Button Bar active segment with Slider?
                        arjen.evertse

                        A case statement is basically a list with ifs and after the last one you can add a default result. Your stat can have a default result or not, but the end has no ;.

                         

                        Something like:

                         

                        Case (

                         

                        if ; then ;

                        elseif ; then ;

                        elseif ; then ;

                        resultifnoneistrue

                         

                        )

                         

                        The case statement stops evaluating a soon as something tests true or the end is reached.

                        • 9. Re: Button Bar active segment with Slider?
                          philmodjunk

                          Here's the alternative in more detail:

                          Use OnPanelSwitch to perform this script:

                           

                          Set Variable [$$FrontPanelName ; Value: GetValue ( Get ( TriggerTargetPanel ) ; 2 ) ]

                          Refresh Object ["ButtonBarName"]

                           

                          You might need to name each button and refresh them all here if refreshing the whole buttonbar doesn't work.

                           

                          But even then, what you have is much simpler no?

                          • 10. Re: Button Bar active segment with Slider?
                            arjen.evertse

                            The most simple would be to name the buttons the same as the panels. Then the calc for the active button would be simply $$FrontPanelName. You calc would need more logic to account for the button that is not connected to a panel (you mentioned 5 of 6 buttons are related to panels?) depending on what that last button does.

                            • 11. Re: Button Bar active segment with Slider?
                              ezeitgeist

                              $$FrontPanelName is my global variable, yes? I'm trying to follow and I think I'm missing something. How does this identify the specific slide and then identify which specific button to bring to the front? I'm not super familiar with "Value: GetValue ( Get ( TriggerTargetPanel ) ; 2 )". Will research, but in case it is something simple that I'm missing.

                              • 12. Re: Button Bar active segment with Slider?
                                arjen.evertse

                                ezeitgeist wrote:

                                 

                                Also, trying it and two of the buttons in the button bar are drop-downs and when clicked, the slides opened in the drop-down buttons do not show the active button like the others.

                                Sorry, I missed this part of your reply. With drop-down do you mean Popover?

                                 

                                In a button bar buttons with popover are active as long as the popover is open. How do you want it to work? Any chance to share a screenshot of your interface?

                                • 13. Re: Button Bar active segment with Slider?
                                  arjen.evertse

                                  Let's summarize assuming your panels are named Panel1, Panel2, Panel3, etc, your buttons in the button bar are named Button1, Button2, Button3 and the buttonbar as a whole ButtonBar1. You can ofcourse replace this with any names you want.

                                   

                                  A script assigned to the script trigger OnPanelSwitch will run any time the slide control changes to a different slide. Script triggered with by this trigger can use Get(TriggerTargetPanel) which will return two values, the first being the index number, the second being the object name of the slide that is going to become the front slide.

                                   

                                  In the script the global variable is set by GetValue ( Get ( TriggerTargetPanel ) ; 2 ) which means the second value of the result of Get (TriggerTargetPanel) meaning the object name of the slide that is going to be the front slide.

                                   

                                  After the global variable is set we refresh the buttonbar to re-evaluate the active button calculation since the global variable on which this calculation is based has been or might have been changed.

                                   

                                  In the calculation for the active button in your button bar you have a case statement checking the global variable and make use the button name as the result.

                                   

                                  Forget my previous reply about naming the buttons the same as the panels, you can't have the same object name twice on the same lay-out.

                                   

                                  You could still specify the calculation for the active button as a simply your global variable in case you would use the button names as 1, 2, 3 etc and change the script step to set the global variable to GetValue ( Get ( TriggerTargetPanel ) ; 1 ). In that case you get the first value of the Get(TriggerTargetPanel) result which is the index number of the slide instead of the name.

                                  • 14. Re: Button Bar active segment with Slider?
                                    ezeitgeist

                                    Screen Shot 2017-06-30 at 6.49.28 PM.png

                                    The top "Motivation" through "Help" is the button bar. "Connection &" and "Help &" are PopOver buttons that I have added buttons within those popovers that are navigation buttons as well.

                                     

                                    In this case, all 3 buttons under "Connection &" bring you to different slides in that same layout (as do the non-PopOver buttons in the bar). I'd like on all three of those slides to have "Connection &" button bar button active.

                                     

                                    I tried with arjen's approach and works for all PopOver buttons EXCEPT the first one down (top most). "Help &" PopOver has two buttons in the PopOver, the bottom one is to a different layout, the top one to a slide in the original layout. The top button, again, does not set "Help &" active when clicked.

                                    1 2 Previous Next