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
$$CurrentPanel = 2
...depending on which button was pressed.
Then refresh your buttons as you already stated, but change the 'Hide When' condition to: $$CurrentPanel = 1 [ Button1]
"OnObjectEnter" will not fire when button is clicked. How about adding the step to the last of button script?
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.
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.
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.
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.
PanelTest.fmp12.zip 69.2 K