?
Solved

MainMenu + hint

Posted on 2006-07-18
3
Medium Priority
?
501 Views
Last Modified: 2010-04-05
Hi,

What's the best way to display messages in the statusbar
when the user goes thru the menu-items of the MainMenu?

I have allready made a procedure for the Toolbar - buttons, but I don't
know how for the MainMenu-items!

 private
    { Private declarations }
    procedure MyHint(Sender: TObject);

(*-----------------------------------------------*)
procedure TMainForm.MyHint(Sender: TObject);
begin
  StatusBar1.Panels[0].Text := Application.Hint;
end;
(*-----------------------------------------------*)
procedure TMainForm.FormShow(Sender: TObject);
begin
  Application.OnHint := MyHint;
  ShowHint           := True;
  ToolButton1.Hint   := 'New|New Connection';
  ToolButton2.Hint   := 'Open|Open Connection';
  ToolButton3.Hint   := 'Save|Save current connection file';
  ToolButton4.Hint   := 'Print|Print';
  ToolButton5.Hint   := 'Copy|Copy the selection into Clipboard';
  ToolButton6.Hint   := 'Paste|Insert Clipboard contents';
end;
(*-----------------------------------------------*)


Thanks in advance...

Greetings,

Peter Kiers






0
Comment
Question by:peterkiers
[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
  • 2
3 Comments
 
LVL 26

Expert Comment

by:Russell Libby
ID: 17130341
Set the hint for each menu item, then catch the applications OnHint event, eg;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Menus, ExtCtrls;

type
  TForm1            =  class(TForm)
    MainMenu1:      TMainMenu;
    File1:          TMenuItem;
    Test1:          TMenuItem;
    procedure       FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
     procedure      DisplayHint(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnHint:=DisplayHint;
end;

procedure TForm1.DisplayHint(Sender: TObject);
begin
 // Set whatever status control text
  Caption:=GetLongHint(Application.Hint);
end;

end.

Regards,
Russell
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 2000 total points
ID: 17130362
Looking at your code, you are already catching the Application's OnHint, so just set each menu items' .Hint property and you should be set

Russell
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17130400
Thanks Russell.

Peter
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

770 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