Solved

MainMenu + hint

Posted on 2006-07-18
3
495 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 500 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

Industry Leaders: 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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
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.…

696 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