Re earlier I have improved this code because there doesnt seem to be any
other suitable solution to finding the tray icon location. Pse replace my
earlier code with the below
//global TrayIconRight:word; TrayIconActive:boolean;
//the following sets up position
procedure TPlayerForm.RxTrayMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
//TrayIconRight
//set right margin and check in case new tray incons installed
//Tray icon width is 18(X)

  if (X > TrayIconRight) or (TrayIconRight - X > 18) then
  begin
  TrayIconRight := X;
  TrayIconActive:=false;
  end;
  if (TrayIconRight-x)>=14 then TrayIconActive:=true;
end;

//The following uses it
procedure TPlayerForm.RxTrayClick(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
//Allow short delay just in case double click (form made visible)
  delay(GetDoubleClickTime());
  if Playerform.Visible then exit;
  if not TrayIconActive then //IconRight = 0 then
  begin
    menuPauseClick(self);
    exit;
  end
  else
    x := TrayIconRight - x;
  if x <= 4 then menunextclick(self)
  else if x <= 12 then menupauseclick(self)
  else menupreviousclick(self);
end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to