I have several dynamic toolbars with dropdown lists (xtpControlSplitButtonPopup) that change based upon the type of 'document' that a user has opened. For example, I want to display 3 control buttons with 'A', 'B', and 'C' one time a user logs in and I want it to be 'D', 'E', and 'F' on the next login.
I'm fine loading these programically, but as soon as I use LoadStateFromString to try to restore the last position of each of the application's toolbars, I run into problems. My dropdown lists no longer contain the values I programitacally load. Instead they show the content of the lists as they were when I last called SaveStateToString.
I can see where that might make sense, but when I try delete these list items and re-add them with the correct items, the control doesn't update on the screen. If I had 'A', 'B', and 'C' showing the last time I called SaveStateToString and then run code such as:
-------------------
Public ToolbarAssignment As CommandBar Public ToolbatAssignmentPopup As CommandBarPopup
-------------------
Set ToolbarAssignment = CommandBars1.Add("Assignment", xtpBarTop) With ToolbarAssignment.Controls Set ToolBarAssignmentPopup = .Add(xtpControlSplitButtonPopup, 0, "Assignments") ToolBarAssignmentPopup.ID = ID_ASSIGNPOPUP
End With
CommandBars1.LoadStateFromString &nbs p;
ToolBarAssignmentPopup.CommandBar.Controls.DeleteAll ToolBarAssignmentPopup.CommandBar.Controls.Add(xtpControlBut ton, 100, 'D') ToolBarAssignmentPopup.CommandBar.Controls.Add(xtpControlBut ton, 101, 'E') ToolBarAssignmentPopup.CommandBar.Controls.Add(xtpControlBut ton, 102, 'F')
---------------------
After this, the control still shows 'A', 'B', and 'C' When I access the ToolBarAssignmentPopup buttons through code, I correctly see 'D', 'E', and 'F'. Do I need to do something to force the control to repaint or refresh? Does my variable ToolBarAssignmentPopup no longer reference the same node in the commandbar after calling LoadStateFromString?
Thanks.
|