?
Solved

Messenger-like notification popup

Posted on 2010-01-10
5
Medium Priority
?
2,783 Views
Last Modified: 2013-11-22
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
Comment
Question by:everactive
[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
5 Comments
 
LVL 8

Expert Comment

by:Pramod Bugudai
ID: 26281152
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
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 2000 total points
ID: 26281759
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
 

Author Comment

by:everactive
ID: 26281992
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
 
LVL 4

Expert Comment

by:urban_smurf
ID: 26282020
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
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 26282255
@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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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