We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

XPMenus Bar Order

I hope I haven’t overlooked an FAQ or forum entry where this was addressed. We’ve created a form that is housed in an MDI parent per your instructions in the XPMenu FAQ 10.5 Why is an additional instance of my child Form created by the menus framework? We construct the menus at runtime and we have a blank constructor which calls Me.InitializeBarItems() and Me.InitializeBars(New XPMenus.ChildFrameBarManager(Me.components, Me)) This is in addition to the main constructor’s calls to both of those subroutines. Me.InitializeBarItems() Me.InitializeBars(New XPMenus.ChildFrameBarManager(Me)) Or Me.InitializeBars(New XPMenus.MainFrameBarManager(Me)) if not MDI This has lead to the weird behavior observed when in the MDI parent-child mode: When the first instance of the form is created the order of the bars in the XPMenu is reversed from the desired order. When a second or third instance of the form is created the bars in the menu appear in the proper order. When the form is called on its own (non-MDI) the order of the bars is correct. InitializeBars() adds the bars to the XPMenu like so: mBarManager.Bars.Add(mSessionBar) mBarManager.Bars.Add(mViewBar) I've even tried mBarManager.Bars.AddRange(New XPMenus.Bar() {mSessionBar, mViewBar}) but that still didn’t solve the flip-flop of the bars’ order. I have just downloaded and installed 1.5.2.0 – there was no change to this situation. Any thoughts? Thanks, Tom

4 Replies

Ramesh Praveen February 28, 2003 01:14 PM UTC

Tom, Try enclosing your barmanager initialization within BeingInit and EndInit calls (in the barmanager). That might make a difference. If it still didn't work, please attach that InitiazeBars method code here. Regards, Praveen Ramesh

TL Tom Le Blanc February 28, 2003 01:28 PM UTC

I tried using the BeginInit and EndInit in here but still no dice. Private Sub InitializeBars(ByVal barManager As XPMenus.BarManager) 'BarManager mBarManager = barManager mBarManager.Categories.Add("Session") mBarManager.Categories.Add("Actions") mBarManager.Categories.Add("Scenarios") mBarManager.Categories.Add("Years") mBarManager.Categories.Add("Rows") mBarManager.CurrentBaseFormType = "System.Windows.Forms.Form" mBarManager.EnableCustomizing = False mBarManager.Form = Me mBarManager.ImageList = Me.IconList mBarManager.Items.AddRange(New XPMenus.BarItem() {mSaveBarItem, mCalculateBarItem, mResultsBarItem, mAddScenarioBarItem, mPropertiesBarItem, mViewBarList}) mBarManager.LargeImageList = Me.IconList mBarManager.UsePartialMenus = False 'SessionBar mSessionBar = New XPMenus.Bar(mBarManager, "Session") mSessionBar.BarStyle = XPMenus.BarStyle.Visible Or XPMenus.BarStyle.DrawDragBorder mSessionBar.Items.AddRange(New XPMenus.BarItem() {mSaveBarItem, mCalculateBarItem, mResultsBarItem}) mSessionBar.BeginGroupAt(mCalculateBarItem) 'ViewBar mViewBar = New XPMenus.Bar(mBarManager, "View") mViewBar.BarStyle = XPMenus.BarStyle.Visible Or XPMenus.BarStyle.DrawDragBorder mViewBar.Items.AddRange(New XPMenus.BarItem() {mViewBarList, mAddScenarioBarItem, mPropertiesBarItem}) 'Add both bars to the bar manager. mBarManager.Bars.Add(mSessionBar) mBarManager.Bars.Add(mViewBar) End Sub Thanks, Tom

Ramesh Praveen March 3, 2003 08:05 PM UTC

Tom, I am out of ideas now. Could you please prepare a small sample and attach it here? Note that the toolbar positions will also be based on the persisted state of the previous instantiation. You could set AutoLoadToolBarPositions to false and check if the behavior is any different. Regards, Praveen Ramesh

AT Andy Tarpey March 4, 2005 10:35 AM UTC

I had a similar problem with toolbar ordering when I was dynamically creating them at run-time. In the end I solved it by setting MainFrameBarManager.BarPositionInfo to null. Hope this helps, Andy.
Loader.
Live Chat Icon For mobile
Up arrow icon