Setting Perspective session and page properties

From the release notes for 8.0.5:

Added a session property (appBar.togglePosition) that can be used to set the app bar toggle to positions ‘left’, ‘right’, or ‘hidden’. Also added a page property (appBarVisible) that can be written to in order to directly display the app bar.

How do you set these Perspective session and page properties?

1 Like

If you click on Perspective in the project browser you can edit the appBar property under SESSION PROPS.
Otherwise it looks like you can edit the two properties with scripting like this:

	self.session.props.appBar.togglePosition = 'hidden'
	self.page.props.appBarVisible = False

Your directions to the session props were helpful, thanks. This method works.

I couldn’t find where to set the page props or where to put a script to set them directly. It would be good to know for future reference. Any thoughts?

1 Like

I just found the Page Startup event by clicking the Project > Session Events in the navigation bar at the top of the designer, but that says that some of the page props do not return valid values at the time of the startup event.

Maybe you could try setting the page property in the onStartup event of your page’s primary view? I think that this would work as long as you aren’t using that view anywhere else where you would want different page properties. Even in that case it should be possible to pass a parameter to the view that indicates whether or not to set the page property.

I’ve just finished speaking to Joe in support about this. The easiest way seems to open the page and create a new custom property, then bind this property bidirectionally to the page appBarVisible property which you can look up with the property browser. What you don’t do is add a new prop to the ‘PROPS’ section - this doesn’t work.

Thanks for looking into this with me!

2 Likes

What are you trying to accomplish, @AlThePal?

Primarily trying to expand my knowledge of Perspective! We’ve just updated a customer to 8.1 and are starting to port some existing projects to Perspective.

Great, but if you’re attempting to set the position of the App Bar during some condition I might be able to provide a better way - depending on when it needs to occurs and under which circumstances.

I’m always keen to learn new stuff. Please feel free to post your tips or pm me as appropriate.