Limit the menu length

Normaly the menu have the length = with form width. I wish, for example to limit the menu with to Form1.Width-30. I wish to add a label in this 30 pixels.

How to do ?
LVL 9
ginsonicAsked:
Who is Participating?
 
mocartsConnect With a Mentor Commented:
Starting from Delhpi 6 there is ActionMainMenuBar which has panel like behaviour i.e. you can align and size it to fit your needs.
But this component is a bit complex to design (code) as it envolves actionmanager, actionitems, actionbars and actionbaritems... but finally you will have xp like menu bar :)

wbr, mo.
0
 
ginsonicAuthor Commented:
I use D6, so is OK. But how to do that?
0
 
ginsonicAuthor Commented:
I wish to use MyMenu because I customised it. Is derived from the standard TMainMenu.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
mocartsCommented:
you can't port easily, except, if you have an Actions used to build menu functionality.
0
 
ginsonicAuthor Commented:
Sorry but I'm new to this topic (Actions).

My menu look alike:

unit MyMenu;

interface

uses
  Windows, Messages, SysUtils, Classes, Menus,Graphics;

type  
  TMyMenu = class(TMainMenu)
  protected
    function  GetHandle: HMENU; override;
  public
    {}
  published
     {}
    end;

procedure Register;

implementation


function TMyMenu.GetHandle: HMENU;
var
  XMenuInfo: TMenuInfo;
  i: integer;
  Brush:TBrush;
begin
  Result := inherited GetHandle;
  XMenuInfo.cbSize := SizeOf(TMenuInfo);
  XMenuInfo.fMask := MIM_BACKGROUND;
  Brush:=TBrush.Create;
  Brush.Color:=$00413730;
  XMenuInfo.hbrBack := Brush.Handle;
  SetMenuInfo(Result, XMenuInfo);
  for i := 0 to Items.Count - 1 do
    SetMenuInfo(Items[i].Handle, XMenuInfo);
end;

procedure Register;
begin
  RegisterComponents('Nick''s', [TMyMenu]);
end;

end.
0
 
mocartsCommented:
if found simple but powerful TMenuBar component in net - try it:
http://www.akzhan.midi.ru/devcorner/samples/menubar/menubar.html
this component is descendant of TPanel - so you can resize and place anywhere you want on form and costumize bar color too..
..and enable/disable with no problems by using only one property - Enabled ;)
wbr, mo.
0
 
mocartsCommented:
sorr, not TPanel descendant (that's from other sources mixed me :), but TToolbar - anyway it's doesn't make sense :)
mo.
0
All Courses

From novice to tech pro — start learning today.