Is there a way to change the style of an element in a master or a template onPageLoad?

Dann Gardner shared this question 4 years ago
Answered

I want to build a navigation section once, either in a master or a template, and call it from multiple pages. That's simple enough - but when that page loads, I want the style of the appropriate nav item to reflect the 'on' state for that page. I tried using the onPageLoad event trigger, but that only allows me to change the style of widgets on the page as opposed to those being called from masters or a template.


Is there a way to do this in Prototyper Pro?

Comments (2)

photo
1

Hi,


You have three options to simulate this:


1) copy and paste the content from the master/template and change what you need on every screen manually (not elegant but it works for a small number of pages)


2) create a variable and assign states(like numbers, words...) to the variable with OnPageLoad events in every screen. Then in the master (and this only works with masters) with an OnPageLoad event check the state of the variable and edit the styles and change what you need. This works because the OnPageLoad events from the screen are executed first, and then the OnPageLoad from the master are executed.


3) on every screen draw a panel over what you want to modify from the template with the content modified as you like.


Regards,


Marc

photo
1

Thanks, Marc. I took option #1 for the sake of expediency, but #2 definitely seems like the most elegant option and I'll revisit that one once I have more time.