Adding conditions based on page status.
June 6, 2022 12:00 AM
I created a main menu page that displays three menu items. In order to prevent learners from jumping to the end of the course, only one menu is active. These menu items are not buttons, rather images with text; the "on click" action is set on the text. If the learner revisits the main menu again later, I would like all the menu items active. Is this possible?
The process I've tried:
created duplicate menu items, e.g., 2 without menu actions, 2.2 with menu actions.
main menu page action set on show, show menu 2 if the page status equals not started, else show menu 2.2
I've also tried:
created duplicate menu items
main menu page action set on show, show menu 2 if the page status equals not started, else show menu 2.2
main menu page action set on show, hide menu 2 if the page status equals completed, else hide menu 2.2
I feel like this process is simple but somehow, I cannot figure it out. Any input would be helpful.
Thank you.
Solution
Hi @Shannon_SLU02 Creating menus based on visited states can be tricky. I notice in particular that you used images instead of buttons, but buttons have the best function states to build a menu like this, and you can set your buttons as images! I added a sample built in Lectora 21.2. Basically, create a button, then on the Style tab, change the fill to be your image. You can resize it and change the corner shape too. Next, tap on the States area and change the Disabled state to Custom. I changed the opacity to 40 to represent disabled. Then added 2 actions to each. First, I set OnShow ThisObject (note not page) Set state to Disable then added the condition IF Page (page that must be visited first) is Not Started. The second action is OnMouseClick GoTo Page. The mouse click won't work if the button is disabled. I repeated this for the other buttons. Please note that in top-down order, the OnShowThisObject should be first, then the OnMouseClick action.
For images that you do not want to be shown, use similar logic by setting the property to Initially Hidden, then instead of the OnShowSetState, use OnPageShowShow Button IF DependentPage IS Complete. This will show the image button and then be active.
Button 2 in the sample has this functionality.
I hope this helps!
Sheryl
Discussion (2)
Hi @Shannon_SLU02 Creating menus based on visited states can be tricky. I notice in particular that you used images instead of buttons, but buttons have the best function states to build a menu like this, and you can set your buttons as images! I added a sample built in Lectora 21.2. Basically, create a button, then on the Style tab, change the fill to be your image. You can resize it and change the corner shape too. Next, tap on the States area and change the Disabled state to Custom. I changed the opacity to 40 to represent disabled. Then added 2 actions to each. First, I set OnShow ThisObject (note not page) Set state to Disable then added the condition IF Page (page that must be visited first) is Not Started. The second action is OnMouseClick GoTo Page. The mouse click won't work if the button is disabled. I repeated this for the other buttons. Please note that in top-down order, the OnShowThisObject should be first, then the OnMouseClick action.
For images that you do not want to be shown, use similar logic by setting the property to Initially Hidden, then instead of the OnShowSetState, use OnPageShowShow Button IF DependentPage IS Complete. This will show the image button and then be active.
Button 2 in the sample has this functionality.
I hope this helps!
Sheryl
Thank you so much, Sheryl. This is exactly what I needed.