> Hi I want to use a group of 3 tray icons, and activate and hide them as one.
> To create:
> for loop := 0 to 2 do
> TrxTray[loop]:=Trxtrayicon.Create(self);
>
> file://What I want to do, is as follows, but grouped, as this is messy:
> for loop := 0 to 2 do
> TrxTray[loop].show; file://shows each icon, one at a time on the tray - could
> look crappy
> So how do I control them as a group??
I'd consider encapsulating the Icons array into a container with a foreach feature.
EG
procedure ShowIcon(Icon :TrxTrayIcon);
begin
Icon.Show;
end;
begin
TrayCollection.Foreach(ShowIcon);
end;
You can probably hardcode the ShowAll, HideAll and the Create and release mechanisms
as these would be pretty common for TrayIcons.
NB If you must use fixed arrays, try using an enumeration for the Index so that future
readers
don't have to remember what index 2 is...
EG
type
TPlayerIconType = (itEJECT,itPLAY,itSTOP,itPAUSE,itREWIND,itFASTFORWARD);
TPlayerIconTypes = set of TPlayerIconType;
const
PlayerIconResIds :array[TPlayerIconType] of Integer =
(1000,1001,1002,1003,1004,1005);
var
Icons :array[TPlayerIconType] of TrxTrayIcon;
I :TPlayerIcontype;
begin
for I := low(I) to High(I) do Icons[I] := TrxTrayIcon.Create(Self);
// Load from resource maybe ;)
end;
Just an idea. The const and set lines are to show the flexibility of the model...
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz