• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2906
  • Last Modified:

Messenger-like notification popup

Hello,

I have a little custom form that I would like to gradually show/hide, just like the messenger notifications.

I don't want to use any custom components, because my little custom form has many functionaries plus it looks neat :)

Thanks.
0
everactive
Asked:
everactive
1 Solution
 
Pramod BugudaiCommented:
Hi.What I think is to minimize to system tray. If is it so then follow the link.

http://www.programmersheaven.com/mb/delphikylix/125667/125667/minimize-to-system-tray/?S=B20000
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Without components?
The easyest way?
Ok, just put a TButton on a new form and use this code.
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
  function TaskBarHeight: integer; // this is just to get the taskbar height to put
  // my form in the correct position
  var
    hTB: HWND;
    TBRect: TRect;
  begin
    hTB := FindWindow('Shell_TrayWnd', '');
    if hTB = 0 then
      Result := 0
    else
    begin
      GetWindowRect(hTB, TBRect);
      Result := TBRect.Bottom - TBRect.Top;
    end;
  end;

begin
  Self.Left := Screen.Width - Self.Width;
  Self.Top := Screen.Height-Self.Height-TaskBarHeight;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
  TimeSleep: integer;
begin
  TimeSleep := 5; // the speed you want to show/hide.Increase/descrease this to make it faster or slower
  for i := 1 to Self.Height do
  begin
    Self.Top := Self.Top+1;
    Sleep(TimeSleep);
  end;
  // now let's show it again(use this as code as the show code)
  for i := 1 to Self.Height do
  begin
    Self.Top := Self.Top-1;
    Sleep(TimeSleep);
  end;
end;

end.

Open in new window

0
 
everactiveAuthor Commented:
Hi Ferruccio,

It worked perfectly, but I have a TImage control (Align: alClient) on the form and only half the image is painted until the form is fully loaded the rest is shown. I believe what is not being painted is the size of the taskbar.

When I add ImageBackground.Refresh; or ImageBackground.Repaint; it's flikering.

Please help. Thanks.
0
 
urban_smurfCommented:
Hi,

Here is a link to a component that allows any delphi form to be shown as an Msn-style pop up window, there is also a demo project included.

http://hotfile.com/dl/23752926/a0411b9/Delphi_form_as_popup.zip.html

Hope that helps!
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
@When I add ImageBackground.Refresh; or ImageBackground.Repaint; it's flikering.

Try Simply setting the property DoubleBuffered of your form to true without any other image property change or image method call.
This should solve the flickering and the right image painting (in my test code works fine)
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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now