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.
Unfortunately, activation email could not send to your email. Please try again.

Custom controls in XPMenus framework?

Thread ID:

Created:

Updated:

Platform:

Replies:

17082 Jul 30,2004 09:27 AM Aug 3,2004 07:47 PM Windows Forms 6
loading
Tags: Tools
Justin Koh
Asked On July 30, 2004 09:27 AM

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)?

Administrator [Syncfusion]
Replied On July 30, 2004 05:54 PM

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.

Justin Koh
Replied On August 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 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?

Administrator [Syncfusion]
Replied On August 2, 2004 06:05 PM

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.

Justin Koh
Replied On August 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 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

Justin Koh
Replied On August 3, 2004 08:20 AM

I forgot to say that the code above should be in the MdiChildActivate function of the main form.

Administrator [Syncfusion]
Replied On August 3, 2004 07:47 PM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;