Sharing toolbar between web pages

Xojo 2020R2.1

I am currently mocking up an application frame to see whether we progress with Xojo web. First stumbling block is menus. What I want to do is define a toolbar once and assign it to multiple web pages, similar to assigning a common menu to multiple windows in Xojo desktop.

All the tutorials I have looked at only show a toolbar being defined within the webpage.

Do I really need to duplicate the menu five times for an application with five pages?

Can anyone suggest a way to define a menu at the App level and add it to the web pages dynamically.

You can define the Toolbar as a Class and insert it onto each WebPage, but…

Do this instead:

  1. Add a Toolbar across the left/top/both
  2. Add a PagePanel across the whole page
  3. Add WebContainers to each PagePanel (optional)
  4. As you choose Toolbar items, display the appropriate PagePanel

Add a Container to the project, add a toolbar to the container. Create the buttons and menus as needed. Add the container to each webpage where you need the toolbar

2 Likes

Thanks for the suggestions.

I went with the container control in the end.

  • Created a container with a toolbar inside.
  • The menu toolbar is built within the container opening event.
  • The toolbar menuItemSelected event calls a method in the session object and passes the hitItem.
  • The method in the session object contains a select case which switches the current webpage according to the hitItem tag.

Clunky to set up, prone to typos, feels decidedly anti-RAD, but does the trick. I can drag the container onto multiple web pages and add a common menu handler in the select case statement.

1 Like