Custom controls in XPMenus framework?
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)?
SIGN IN To post a reply.
6 Replies
AD
Administrator
Syncfusion Team
July 30, 2004 09:54 PM UTC
Hi Justin,
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.
Regards,
Guru Patwal
Syncfusion, Inc.
JK
Justin Koh
August 2, 2004 01:49 PM UTC
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
MainFrameBarManager1.DetachedCommandBars.Remove(CommandBar1)
Else
If MainFrameBarManager1.DetachedCommandBars.IndexOf(CommandBar1) = -1 Then
MainFrameBarManager1.DetachedCommandBars.Add(CommandBar1)
CommandBar1.Visible = True
End If
End If
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?
AD
Administrator
Syncfusion Team
August 2, 2004 10:05 PM UTC
Hi Justin,
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()
mainFrameBarManager1.DetachedCommandBars.Add(cmdbar)
cmdbar.Visible = True
End Sub ''MdiForm_Load
Private Sub MdiForm_Close(sender As Object, args As CancelEventArgs)
Dim cbar As CommandBar = mainFrameBarManager1.DetachedCommandBars(0) ''
mainFrameBarManager1.DetachedCommandBars.Remove(cbar)
cbar.Dispose()
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.
Regards,
Guru Patwal
Syncfusion, Inc.
JK
Justin Koh
August 3, 2004 12:19 PM UTC
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
CommandBar1.Controls.Add(New TrackBar)
If miRowIndex <> -1 Then
CommandBar1.RowIndex = miRowIndex
CommandBar1.RowOffset = miRowOffset
End If
MainFrameBarManager1.DetachedCommandBars.Add(CommandBar1)
End If
Else
miRowIndex = CommandBar1.RowIndex
miRowOffset = CommandBar1.RowOffset
MainFrameBarManager1.DetachedCommandBars.Remove(CommandBar1)
End If
JK
Justin Koh
August 3, 2004 12:20 PM UTC
I forgot to say that the code above should be in the MdiChildActivate function of the main form.
AD
Administrator
Syncfusion Team
August 3, 2004 11:47 PM UTC
Hi Justin,
Thanks for sharing this information with us. Please let me know if you need any other information. We appreciate your interest in Syncfusion products.
Regards,
Guru Patwal
Syncfusion, Inc.
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
JK Justin Koh
- Jul 30, 2004 01:27 PM UTC
- Aug 3, 2004 11:47 PM UTC