I have a quick question. Maybe I am missing something here, but is there a way to dynamically replace a toolbar with another one?
For example, say that I have two tabs: Members and Notes
If the user clicks on the “Members” tab, the members toolbar should be shown. However, if the user selects the “Notes” tab, the notes toolbar should display.
One idea is to use the same toolbar and dynamically remove the irrelevant buttons and replace them with the one for the relevant tabs.
Here is a dirty example (it’s not the best coding but you can clean it up yourself). In this example, I set up the toolbar with two buttons at the offset, each time you change the tab, the second button change.
This is the code that does the magic, I called it setToolBarButtons which accepts the tab index.
toolbar11.removebuttonAt(1)
var newbutton as new DesktopToolbarButton
if index = 1 then
newbutton.Caption = "Set 2"
newbutton.Name = "btn1"
newbutton.ButtonStyle = DesktopToolbarButton.buttonstyles.PushButton
else
newbutton.Caption = "Set 1"
newbutton.Name = "btn1"
newbutton.ButtonStyle = DesktopToolbarButton.buttonstyles.PushButton
end if
toolbar11.AddButtonAt(1,newbutton)
In the TabPanel’s PanelChanged() events, the code I use is
setToolBarButtons(me.SelectedPanelIndex)
I am sure there are other ways to do this but hope that gets your juices flowing.