Help with LoadStateFromString |
Post Reply |
Author | |
JoshV
Newbie Joined: 09 January 2005 Location: United States Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 09 January 2005 at 5:57pm |
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 -------------------
End With CommandBars1.LoadStateFromString &nbs p; ToolBarAssignmentPopup.CommandBar.Controls.DeleteAll ---------------------
Thanks. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
First make sure that ToolBarAssignmentPopup was added to the toolbar before the layout was saved.
Try: CommandBars.LoadStateFromString Set ToolBarAssignmentPopup = CommandBars.ActiveMenuBar.FindControl(xtpControlSplitButt onPopup, ID_ASSIGNPOPUP, ,TRUE) With ToolBarAssignmentPopup .CommandBar.Controls .Add xtpControlBut ton, 100, 'D' .Add xtpControlBut ton, 101, 'E' .Add xtpControlBut ton, 102, 'F' End With Edited by SuperMario |
|
JoshV
Newbie Joined: 09 January 2005 Location: United States Status: Offline Points: 2 |
Post Options
Thanks(0)
|
When I call FindControl as outlined above, it sets ToolBarAssignmentPopup to Nothing. If I just reference the object variable without setting it in the FindControl call, it is not Nothing (ie ToolbarAssignmentPopup is Nothing = False). This object reference (ToolbarAssignmentPopup) allows me to call ToolbarAssignmentPopup.CommandBar.Control.DeleteAll etc, without generating an error, but they have no effect on the screen. If I don't call LoadStateFromString in the code segment you gave above, the FindControl works without a problem and returns a reference to the control that I want. That would be fine, except I need the toolbar positioning that I can only get from LoadStateFromString. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
In the saved layout do you have a popup with Id = ID_ASSIGNPOPUP?
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |