[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

attach a main menu to a unit

Posted on 2008-11-12
4
Medium Priority
?
150 Views
Last Modified: 2012-05-05
i've created a customized unit (a TForm Class) and have created a TMainMenu component in code. I need to make sure that when forms of this class are created that the TMainMenu item gets assigned and shows on the form,..how do i do this? Ultimately what i'm trying to do is "transfer" an existing main menu from a form that gets docked inside of another form, so that the receiving form gets the menu, since i lose the original main menu when the dock is complete.
0
Comment
Question by:Michael Sterling
  • 2
3 Comments
 
LVL 1

Author Comment

by:Michael Sterling
ID: 22942268
as a follow up, maybe another question i can/should ask is,..in a DockDrop or DockOver event you have "Source" as part of your parameter list how do i grab the Source's MainMenu item (presumming that i know there will be one ahead of time) and assing it to the main menu item of the form i'm docking to?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22947672
a menu has a procedure called merge
to merge the menu of the docked form to the main window:

MainForm.Menu.Merge(DockedForm.Menu);

for the merge to work correctly you need to set the GroupIndex property of each main menu item
Like in the MainMenu set File GroupIndex to 1, Help to 100
For a dockedform you could set GroupIndex to 90
They get ordered by this groupindex in the combined menu
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 2000 total points
ID: 23312536
the question was answered and like this statement below says from ziolko :

but you asked the question and we've answered it, points are given for answers not for what you need or don't need anymore

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question