4 Answers, 1 is accepted
Ok lets try again, posted by mistake.
I am having trouble merging the main menu with an MDIChild form. What i what to have happen is the MDI child menu is inserted into the main menu at particular points. For example:
Main Menu: File Windows Help
MDI Form: Project Query
Merged Main Menu: File Project Query Windows Help
What i get automatically when the MDI form is maximized is: File Windows Help Project Query
Doesn't seem to matter what i use for the MergeIndex, MergeType and MergeOrder properties. The MDI child menu is always on the right of the main menu help.
Anybody know how to do this?
I can provide a demo project in VB.NET 2012 and Telerik WinForms VSExtensions 2014.6.1128.0 if needed.
Thanks!
Thank you for writing.
I have tested this and it appears that the MergeOrder property is not working correctly. I have logged this issue in our Feedback Portal. You can track the item for status changes and add your vote for it here.
I have attached a small project to the issue description. It shows how you can manually create such functionality.
Your Telerik Points have been updated for this report.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Hi Dimitar,
Thanks for the update. Here is what I did for a work around.
I declared a member variable reference to the main MDI forms menu then created the UpdateMenu and RemoveMenuFromParent functions.
The added event handlers for these three events and updated the menus accordingly.
Private _parentMenu As RadMenu
''' <summary>
''' Adds this forms menus to the parent form's menu
''' </summary>
''' <remarks></remarks>
Private Sub UpdateMenu()
If _parentMenu Is Nothing Then
Throw New InvalidOperationException("The parent menu has not been set properly.")
End If
'if manually add do this
_parentMenu.Items.Insert(1, ActionMenuList)
_parentMenu.Items.Insert(2, QueryManagementMenuList)
End Sub
''' <summary>
''' Removes this forms menu items from the parent window
''' </summary>
''' <remarks></remarks>
Private Sub RemoveMenuFromParent()
If _parentMenu Is Nothing Then
Throw New InvalidOperationException("The parent menu has not been set properly.")
End If
' if manually adding do this
If _parentMenu.Items(1).Equals(ActionMenuList) Then
_parentMenu.Items.RemoveAt(1)
_parentMenu.Items.RemoveAt(1)
mnuMainMenu.Items.Add(ActionMenuList)
mnuMainMenu.Items.Add(QueryManagementMenuList)
End If
End Sub
Private Sub ProjectViewerForm_Activated(sender As Object, e As EventArgs) Handles Me.Activated
Try
If WindowState = FormWindowState.Maximized Then
UpdateMenu()
End If
Catch ex As Exception
'Your Display Error Code Here
End Try
End Sub
Private Sub ProjectViewerForm_Deactivate(sender As Object, e As EventArgs) Handles Me.Deactivate
Try
RemoveMenuFromParent()
Catch ex As Exception
'Your Display Error Code Here
End Try
End Sub
Private Sub ProjectViewerForm_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
Try
If _parentMenu IsNot Nothing Then
If WindowState = FormWindowState.Maximized Then
UpdateMenu()
Else
RemoveMenuFromParent()
End If
End If
Catch ex As Exception
'Your Display Error Code Here
End Try
End Sub
I am glad that you have implemented a workaround for this case. Do not hesitate to contact us if you have other questions.
Dimitar
Telerik