ginsonic
asked on
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 ?
How to do ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I wish to use MyMenu because I customised it. Is derived from the standard TMainMenu.
you can't port easily, except, if you have an Actions used to build menu functionality.
ASKER
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].Handl e, XMenuInfo);
end;
procedure Register;
begin
RegisterComponents('Nick'' s', [TMyMenu]);
end;
end.
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].Handl
end;
procedure Register;
begin
RegisterComponents('Nick''
end;
end.
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.
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.
sorr, not TPanel descendant (that's from other sources mixed me :), but TToolbar - anyway it's doesn't make sense :)
mo.
mo.
ASKER