5 Replies Latest reply on Jan 6, 2017 5:16 PM by justinc

    Hide Button When On Slide/Portal

    sansae

      Hello,

      I have two buttons: btn1 and btn2

      I have two slides: slide1 and slide2 (these are actually portals inside a slide object)

       

      I want to:

      click on btn1 and show slide1 and hide btn1

      click on btn2 and show slide2 and hide btn2

       

      What's working:

      the slides will show as expected, but the buttons do not hide.

       

      I am using "Hide Object When" to do this.

      My calculation for btn1 is:

      GetLayoutObjectAttribute ( "slide1" ; "isFrontPanel" ) = 1

       

      For btn1, it's:

      GetLayoutObjectAttribute ( "slide2" ; "isFrontPanel" ) = 1

       

      I came across this post: Hide button bar segment

      and one user suggested refreshing each object, which in my case is probably:

      Refresh Object [Object Name: "btn1"]

      Refresh Object [Object Name: "btn2"]

      I attached this script to both objects and set a trigger to each with "OnObjectEnter"

       

      My btns still are not hiding.

       

      Can anyone please help? I don't know what's going on.

        • 1. Re: Hide Button When On Slide/Portal
          justinc

          You could just set a global variable in the script that runs when the button is clicked (assuming you pass in the parameter of which button was pressed):

          if ( $ButtonPressed = 1 )

          $$CurrentPanel = 1

          else

          $$CurrentPanel = 2

          end if

           

          ...depending on which button was pressed.

           

          Then refresh your buttons as you already stated, but change the 'Hide When' condition to:  $$CurrentPanel = 1 [ Button1]

           

          Etc.

          • 2. Re: Hide Button When On Slide/Portal
            user19752

            "OnObjectEnter" will not fire when button is clicked. How about adding the step to the last of button script?

            • 3. Re: Hide Button When On Slide/Portal
              justinc

              Although... I was able to get the technique you suggest working.  Perhaps you have the slide panels named incorrectly?  It is tricky to name the actual slide panels - you have to click the navigation dot twice, so that it has a square around it.  Then when you enter a name it is for that particular panel, and not the slider in general.

               

              I used:

              GetLayoutObjectAttribute ( "Panel1" ; "isFrontPanel" ) = 1

               

              as the hide condition for my button.  I had to Refresh the layout (I was doing this manually, so didn't have a script to refresh the specific button object).  But when I did, switching back and forth to the panels correctly hid/showed the button.

              • 4. Re: Hide Button When On Slide/Portal
                philmodjunk

                make sure that you give the buttons actual object names. The label text visible on the button is NOT the object name. Like any other object, you have select the button while in layout mode and enter an object name into the name box of the inspector. You also need to do the same to name your slide panels.

                • 5. Re: Hide Button When On Slide/Portal
                  BruceRobertson

                  It appears you either need to use one of the refresh options, either refresh window or refresh object.

                  Or - first call Freeze Window.

                  In this example I use Freeze Window.

                  I give you the option to turn if off to see the result.