Recent

Author Topic: Creating automatic statusbar messages  (Read 8857 times)

Kyjan

  • New Member
  • *
  • Posts: 41
Creating automatic statusbar messages
« on: July 05, 2011, 09:21:19 pm »
Hi guys,

I was looking for a method with I can show some messages in statusbar. Hours of googling, and I found a solution. Maybe someone is looking for the same help, so here is the solution:

1st: Put a statusbar on your form.
2nd: Set AutoHint property True.
3rd: For example, put a TButton on your form. Set Hint property as you desired. (for example: This is a button)
4th: Set the TButton Showhint property True.

And that's all.

You have three options:
1: If the Hint is just a simple text, you'll see your hint in a bubble, and in the statusbar.
2: If your hint has the following format 1|2 then the "1" will appear in the bubble, the "2" will be shown in statusbar.
3: if your hint looks like "|2", then the bubble will be not shown, but your hint will be visible in the statusbar.

Hope i could help for someone.

Regards,
Kyjan

Dick, from the internet

  • Full Member
  • ***
  • Posts: 198
Re: Creating automatic statusbar messages
« Reply #1 on: July 05, 2011, 10:28:27 pm »
That is a cool little tidbit - thanks for sharing!  Here is another statusbar trick that I found at
http://delphi.about.com/od/vclusing/a/statusbar_owner.htm   to add an icon or change the background colors of individual panels on the statusbar.

procedure TStatusForm.StatusBar1DrawPanel( StatusBar: TStatusBar;
                     Panel: TStatusPanel;  const Rect: TRect) ;
 begin
   with StatusBar.Canvas do
   begin
     case Panel.Index of
       0: //fist panel
       begin
         Brush.Color := clRed;
         Font.Color := clNavy;
         Font.Style := [fsBold];
       end;
       1: //second panel
       begin
         Brush.Color := clYellow;
         Font.Color := clTeal;
         Font.Style := [fsItalic];
       end;
     end;
     //Panel background color
     FillRect(Rect) ;
 
     //Panel Text
     TextRect(Rect,2 + ImageList1.Width + Rect.Left, 2 + Rect.Top,Panel.Text) ;
   end;
 
   //draw graphics
   ImageList1.Draw(StatusBar1.Canvas, Rect.Left, Rect.Top, Panel.Index) ;
 end;
 

 

TinyPortal © 2005-2018