Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCoolTrayIcon - Help

Status
Not open for further replies.

GoldenEye4ever

Programmer
May 26, 2007
20
CA
I just found: TCoolTrayIcon.

I like quite-a-few of it's features; hide app from taskbar when minimized, etc...

However, I can't seem to get the icon animation to work.
I have a series of *.ico files that I'd like it to rotate through.

Since I'm using Turbo Delphi, I cannot install the visual component, I have to create and initialize it from code :(

I need to know how to load the icon files into the TCoolTrayIcon object (either via LoadFromFile or preferably, from an embedded resource)

This is what I'm doing:
Code:
uses
  ...
  CoolTrayIcon;
...
var
  trayicon : TCoolTrayIcon;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
    ...
    Trayicon := TCoolTrayIcon.create(self);
    with trayicon do
      begin
//        IconList.Assign( ImageList );
//        CycleInterval := 100;
//        CycleIcons := true;
        Hint := Application.Title;
        minimizetotray := true; {sets action if user clicks sysmenu minimize icon}
        ShowFormOnTrayIconClick := true;
        persistentTrayIcon := true;
        PopupMenu := TrayIconPopup;
      end;
    ...
end;

I tried adding the ico files to a TImageList object, and then assigning it, but that failed. (that's commented out above)

As the code is above, the TCoolTrayIcon displays the main application icon, and does not cycle/animate the tray icon.

Any help would be greatly appreciated :)
 
ive never used it but looking at the HELP FILE you assign an imagelist of icons to the IconList.

Aaron
 
That's what I thought, but it doesn't seem to work :(

I wish you could install 3rd party visual components in Turbo Delphi, is there any way?

At any rate, this isn't a make-or-break feature for me, but I'd still like to get it working :)
 
delphi comes with its own TTrayIcon on the Additional page, see if its included in the Turbo version.

Aaron
 
Yes, Turbo Delphi comes with a TTrayIcon.
However, it does not have some of the features that I want :(
- minimize entire application to TrayIcon
- ...that's pretty much it

I tried doing this manually using TTrayIcon, but I wasn't able to get it working perfectly (WinXP, Vista, Win7)
Depending on the OS and the version of Delphi being used, different methods have to be used to hide the application from the start bar.

Other than that, the TTrayIcon is fine.

In my app, I give the user the option to minimize the application to the tray icon, or not.
 
I just found: TCoolTrayIcon
Where did you you find it? Is it part of Turbo Delphi?

has a zip download that appears to include source, demo, and docs.

The jvcl (SourceForge) includes TJvTrayIcon, also with complete source.

I have one app that uses TJvTrayIcon and it works just fine.

From my dfm:
Code:
  object JvTrayIcon1: TJvTrayIcon
    Active = True
    Animated = True
    Icon.Data = {
      ... [i]binary data removed for sake of bandwidth[/i] ...
                }
    IconIndex = -1
    Icons = ImageListScan
    Visibility = []
    OnClick = JvTrayIcon1Click
    Left = 40
    Top = 72
  end
I noticed you have:
Code:
  //IconList.Assign(ImageList);
...commented out. I've never used TCoolIcon, but perhaps it should be:
Code:
  IconList:= ImageList;

Also: Is CoolIcon in you component palette? Did you just drop it on the form from your palette? If 'yes' to both, then you should NOT be calling its Create() method (constructor).


Roo
Delphi Rules!
 
Thanks roo0047,
I think I'll try JvTrayIcon, if your suggestion doesn't work.

I just found this component via Google, "Delphi minimize TrayIcon".

Since I'm using Turbo Delphi, I cannot install any 3rd party visual components, thus I just include the .pas files in my applications directory, add them to my project and have to create them manually.
The component works fine, I just can't seem to assign the ImageList to it.
I can't drop the visual component on my form :(

Thanks a lot,
I'm gonna try this as soon as I get home.
 
I couldn't wait.

I installed Turbo Delphi on an old PC at my parents house, and roo0047's solution worked.

Code:
Trayicon := TCoolTrayIcon.create(self);

        with trayicon do
          begin
            [b]IconList := ImageList;[/b]
            CycleInterval := 100;
            CycleIcons := true;
            Hint := Application.Title;
            minimizetotray := true; {sets action if user clicks sysmenu minimize icon}
            ShowFormOnTrayIconClick := true;
            persistentTrayIcon := true;
            PopupMenu := TrayIconPopup;
          end;
Creating the ImageList previously :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top