Solved

Show hints on statusbar

Posted on 2009-05-17
7
423 Views
Last Modified: 2012-05-07

Dear Experts,

I have used the ActionList component for my MainMenu. So my MainMenu is working
great without any code. Event the property Hint is automaticly filled in of each menu-item.
I have also a statusbar. What do I have to do that when i select a menu-item that the
hint of the menu-item will be showned in my statusbar.

Greetings Pk
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
  • 4
  • 3
7 Comments
 
LVL 13

Expert Comment

by:ThievingSix
ID: 24405677
This might be helpful:
unit Unit4;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ActnList, ComCtrls;
 
type
  TMenuItem = class(Menus.TMenuItem)
    private
      FStatusBar: TStatusBar;
    protected
      procedure AdvancedDrawItem(ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState; TopLevel: Boolean); override;
    public
      property StatusBar: TStatusBar read FStatusBar write FStatusBar;
  end;
 
type
  TForm4 = class(TForm)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    New1: TMenuItem;
    Close1: TMenuItem;
    StatusBar1: TStatusBar;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form4: TForm4;
 
implementation
 
{$R *.dfm}
 
procedure TMenuItem.AdvancedDrawItem(ACanvas: TCanvas; ARect: TRect;
  State: TOwnerDrawState; TopLevel: Boolean);
begin
  inherited;
  If (odSelected in State) And (Assigned(FStatusBar)) Then
    begin
    FStatusBar.SimpleText := Hint;
  end;
end;
 
procedure TForm4.FormCreate(Sender: TObject);
begin
  New1.StatusBar := StatusBar1;
  Close1.StatusBar := StatusBar1;
  Statusbar1.SimplePanel := True;
end;
 
end.

Open in new window

0
 
LVL 1

Author Comment

by:peterkiers
ID: 24405721
This is not exactly what i am looking for.

Greetings,

Peter Kiers
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24405723
I think it could be don easer, but I don't know how.
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 13

Expert Comment

by:ThievingSix
ID: 24405726
What exactly are you looking for? I assumed from your original question that you wanted the selected menu item's hint to be shown on your status bar.

I am also unsure as do what you mean on how it can be done easier? It's a pretty simple solution(as simple as I could tell) because there is no event for when your item is selected directly.

Maybe you could help me help you?
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24405941
I think this is a way to start:

private
  procedure MyHint(Sender: TObject);
end;
 

implementation

 {....}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnHint := MyHint;
  ShowHint           := True;
  Button1.Hint       := 'normal yellow hint|Text in Statusbar';
  Button2.Hint       := 'only yellow hint|';
  Button3.Hint       := '|text only in statusbar';
  Edit1.Hint         := 'same text';
end;

procedure TForm1.MyHint(Sender: TObject);
begin
  StatusBar1.SimpleText := Application.Hint;
end;

But how to tell the system to use the proprty hint of every menu-item

Greetings,

Peter Kiers
0
 
LVL 13

Accepted Solution

by:
ThievingSix earned 500 total points
ID: 24405980
I guess you could use the message WM_MENUSELECT to catch the event as in: http://delphi.about.com/od/vclusing/a/menuitemhints.htm

But I still think my way is cleaner.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24406586
Thanks for the info.

Peter K.
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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 80
How to convert memory stream to PDF file 6 227
Delphi...Split view - idea? 1 145
Get weeknumber and year from date 4 56
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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