When a user hovers over a WebToolbar button the Caption increases intensity, (highlighted). Is there a way when pressed that the pressed menu button retains that intensity until a different button is pressed? I would like buttons that present a specific page to remain in that highlighted state when pressed so it indicates the page you have navigated to.
[buttonname].pressed = true
I’m having a hard time figuring out how to address the button name when I display a page and want to set it as pressed. I planned to put a line for this in the WebPage.Shown event. I’ve tried using the Toolbar name but there doesn’t seem to be a function to call the WebToolbarButton by name. everything I have tried gives me a debugging compile error.
Since there’s no visual designer for WebToolbars, you have to access the item by index or tag. You can set the tag when you create the toolbar to make things easier to locate later.
@Tim_Parnell the ItemWithTag().Pressed action does not show in autocomplete and being that API 2 is sometimes missing things from Autocomplete I typed it in anyway, but that creates an error in the debugger. What am I missing?
You need to cast the toolbaritem as a button.
WebToolbarButton(Toolbar_Main.ItemWithTag("Dashboard")).Pressed = True
That worked to get it to compile but did not cause the menu item to be selected/highlighted. It looks no different than before adding that line.
Each web page has a corresponding line in the shown event as follows:
WebToolbarButton(Toolbar_Main.ItemWithTag("Dashboard")).Pressed = True WebToolbarButton(Toolbar_Main.ItemWithTag("CrackPeelHome")).Pressed = True WebToolbarButton(Toolbar_Main.ItemWithTag("CrackPeelRequestForm")).Pressed = True WebToolbarButton(Toolbar_Main.ItemWithTag("CrackPeelFormViewer")).Pressed = True WebToolbarButton(Toolbar_Main.ItemWithTag("CrackPeelProductionReport")).Pressed = True WebToolbarButton(Toolbar_Main.ItemWithTag("CrackPeelConsolidatedReport")).Pressed = True
When you Hover the text gets bold?
When you click one the text does not stay bold?
Can you provide a sample project?
When I hover the text gets bold.
When I click the menu item the Page changes and the line in the identical menu in the new page shown is not bold even though I have added the line with Pressed = True in the Page shown event.
It will take some time to create a sample project but I will see what I can do this afternoon to rip out enough code that you could run the project.
I think that because the Page changes, then the toolbar is reset or changed to a new one (on the new page). If the page doesn’t change then it works:
Maybe you can use the Style Toggle and tell your new page which toggle should be set to Pressed = True
Yeah, each page has it’s own toolbar. Can you clarify what you mean by “use the Style Toggle” My assumption was that telling the Toolbar that an item was pressed was the toggle.
In your Toolbar_MenuConstruct method you are setting the button styles to pushbutton they need to be toggle.
dashboardbtn.style = WebToolbarButton.ButtonStyles.PushButton
dashboardbtn.style = WebToolbarButton.ButtonStyles.Toggle
Changing to Toggle you will get:
Thanks Wayne! That fixed it.
I have to set all the toggle buttons to pressed = false when switching pages so that the hiding page doesn’t have extra menus toggled on when the user returns to it but I’m getting what I was looking for now.