I have an MDI application that currently uses the commandbars framework. I was wondering if I should switch to the XPMenus framework to get the benefits of using the mainframbarmanager and childframbarmanagers. However, what is holding htis up is that I have 1 slider control in the toolbar. Commandbars let me put any type of control into them. It doesn''t appear like the XPMenus Bar controls do. Is there a way to get the slider into the XPMenu so that I can use the other bar managers? Is there another way to get the desired functionality (basically keeping toolbar handling code in the child forms and also making only certain bars visible when different types of child forms are active)?
ADAdministrator Syncfusion Team July 30, 2004 05:54 PM
You could use CommandBars within the XPMenus framework by using the MainFrameBarManager''s Detached CommandBars. The MainFrameBarManager-ChildFrameBarManager interaction will take care of the parent-child menu merging scenario, while the CommandBars will let you host any controls in it. This way you could use the best of both the the XPMenus and CommandBars framework. Please refer to the sample_attached that illustrates this and let me know if this meets your requirements. We appreciate your interest in Syncfusion.
JKJustin KohAugust 2, 2004 09:49 AM
Thank you for your quick response and sample.
I created a test project with a Form1 and a Form2. Now I want the commandbar to only show up when Form2 is displayed. SO, in my MdiChild_Activate event handler, I try to remove it when the form is gone, and add it if needed.
If Me.ActiveMdiChild Is Nothing Then
If MainFrameBarManager1.DetachedCommandBars.IndexOf(CommandBar1) = -1 Then
CommandBar1.Visible = True
Now, it will go away when I close my child form, but it will not come back when I create a new childform. It puts the XPMenus toolbar there, but there is a blank space where the commandbar was.
How can I acheive the desired functionality?
ADAdministrator Syncfusion Team August 2, 2004 06:05 PM
Thanks for the update. Please handle the MDI child form''s Load and Closing event as shown below for this purpose :
Private Sub MdiForm_Load(sender As Object, args As EventArgs)
Dim cmdbar As New CommandBar()
cmdbar.Visible = True
End Sub ''MdiForm_Load
Private Sub MdiForm_Close(sender As Object, args As CancelEventArgs)
Dim cbar As CommandBar = mainFrameBarManager1.DetachedCommandBars(0) ''
End Sub ''MdiForm_Close
Please refer to the complete_sample attached here and let me know if you need further assistance. we appreciate your interest in Syncfusion products.
JKJustin KohAugust 3, 2004 08:19 AM
I looked at your sample, but it wasn''t quite what I was looking for. IN the sample, each chil form has its own commandbar, so there are duplications. I want one commandbar that shows up only when form2 is the active form. I think I''ve figured it out. Here is my solution, for anyone else following this thread.
If TypeOf Me.ActiveMdiChild Is Form2 Then
If CommandBar1.IsDisposed Then
CommandBar1 = New Syncfusion.Windows.Forms.Tools.CommandBar
If miRowIndex <> -1 Then
CommandBar1.RowIndex = miRowIndex
CommandBar1.RowOffset = miRowOffset
miRowIndex = CommandBar1.RowIndex
miRowOffset = CommandBar1.RowOffset
JKJustin KohAugust 3, 2004 08:20 AM
I forgot to say that the code above should be in the MdiChildActivate function of the main form.
ADAdministrator Syncfusion Team August 3, 2004 07:47 PM
Thanks for sharing this information with us. Please let me know if you need any other information. We appreciate your interest in Syncfusion products.