?
Solved

Limit the menu length

Posted on 2003-03-22
7
Medium Priority
?
161 Views
Last Modified: 2011-09-20
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 ?
0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 9

Accepted Solution

by:
mocarts earned 375 total points
ID: 8187348
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
 
LVL 9

Author Comment

by:ginsonic
ID: 8189014
I use D6, so is OK. But how to do that?
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8189109
I wish to use MyMenu because I customised it. Is derived from the standard TMainMenu.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:mocarts
ID: 8189390
you can't port easily, except, if you have an Actions used to build menu functionality.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8190314
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
 
LVL 9

Expert Comment

by:mocarts
ID: 8254876
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
 
LVL 9

Expert Comment

by:mocarts
ID: 8254890
sorr, not TPanel descendant (that's from other sources mixed me :), but TToolbar - anyway it's doesn't make sense :)
mo.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 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