attach a main menu to a unit

Posted on 2008-11-12
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, 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.
Question by:mikesExpertExchange
    LVL 1

    Author Comment

    as a follow up, maybe another question i can/should ask is, 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?
    LVL 36

    Expert Comment

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


    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
    LVL 36

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    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…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now