Link to home
Create AccountLog in
Avatar of Grant Fullen
Grant Fullen

asked on

TrayIcon1 onclick and minamize.

I am useing Delphi 2007 it has a component TrayIcon1 . I am trying to work with the onclick of the ballon hint. I want to do a procedure if of the on click of the baloon hint. And i am trying to figrue out how to minamize and maxamize useing the icon of the TrayIcon.
Thaks
Grant
var
  NumOfMsgs : Integer;
begin
  idPop31.Username := 'gfullen@earthlink.net';
  idpop31.Password := 'GF7777';
  idpop31.Host := 'pop.earthlink.net';
  idpop31.Port := 110;
  idpop31.Connect;
  NumOfMsgs := idpop31.CheckMessages;
  idpop31.Disconnect;
   if NumOfMsgs = 0  then
     Begin
       TrayIcon1.BalloonTitle := 'EarthLink';
       TrayIcon1.BalloonHint := 'You have'+ '  '+inttostr(NumOfMsgs)+'  New Messages';
       TrayIcon1.ShowBalloonHint
 
      end
      else
      if NumOfMsgs = 1  then
       begin
        TrayIcon1.BalloonTitle := 'EarthLink';
        TrayIcon1.BalloonHint := 'You have'+ '  '+inttostr(NumOfMsgs)+'  New Messages';
        TrayIcon1.ShowBalloonHint
        end
      else
      if NumOfMsgs >1  then
       begin
         TrayIcon1.BalloonTitle := 'EarthLink';
         TrayIcon1.BalloonHint := 'You have'+ '  '+inttostr(NumOfMsgs)+'  New Messages';
         TrayIcon1.ShowBalloonHint;
         TrayIcon1.OnClick:= DoMyProcedure <---------------------

Open in new window

Avatar of 2266180
2266180
Flag of United States of America image

that onclick is when you click on teh trayicon, not on the baloon. you don't have an onclick for the baloon hint. AND you must set the handler before you show the baloon, not after it :)

the correct way to handle this is that when user clicks on tray icon you check if the app is minimized and if it is, you maximize it, otherwise, you minimize it. (usually this is done on double click not single click)
Avatar of Grant Fullen
Grant Fullen

ASKER

I need a way to use an onclick for the Baloon Hit. So when the balloon hint is displayed  i can click on it and run my porcedure.
Thanks
Grart
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
and you are deleting this because ...?
in worse case scenario, you have an alternative that will give you what you want. so there is no need for deletion.
It's good now.  I fixed the problem so the points shall be awarded.
Basically I accidentally posted "not needed" code if you see what I mean hehe.