Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MainMenu + hint

Posted on 2006-07-18
3
Medium Priority
?
514 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 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