Cheers...I ahve just been playing with it, but then goot called away...I
will give the code a whirl tho...thanks....
Jeremy
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Mark Derricutt
> Sent: Wednesday, 3 May 2000 04:33
> To: Multiple recipients of list delphi
> Subject: [DUG]: Hint Window (for Jerememy)
>
>
> Just grabbed my code from cvs, I do the following. The variable hwin is
> defined as a THintWindow and created in my constructor.
>
> If the Hint is to be displayed (ie. ShowHint is true, and it differs from
> the previous hint), I call hwin.ActivateHint() with the required rect
> structure.
>
> I then enable a TTimer which simple releases the THintWindow after 3
> seconds (and disables itself).
>
> Mark
>
> procedure TMapField.HandleHint(X,Y: Integer);
> var
> ml: TMapLabel;
> p: TPoint;
> s: string;
> sWidth: integer;
> sHeight: integer;
> i, iWidth: integer;
> begin
> ml := FindItemAtXY(X,Y);
> if Assigned(ml) then
> begin
> GetCursorPos(P);
> s := ml.Name;
> if Assigned(fOnHint) then fOnHint(Self, s);
> // Provide an event to modify s
> if (ShowHint) and (hwin.Caption <> s) then
> begin
> TimerHwin.Enabled := False;
> sList.Text := s;
> // find longest string
> sWidth := 0;
> for i := 0 to sList.Count - 1 do
> begin
> iWidth := hwin.Canvas.TextWidth(sList.Strings[i]);
> if iWidth > sWidth then sWidth := iWidth;
> end;
>
> sHeight := hwin.Canvas.TextHeight(s)*sList.Count;
> hwin.ActivateHint(Rect(P.X,P.Y, P.x + sWidth + 6, P.Y + sHeight),s);
> TimerHwin.Enabled := True;
> end;
> end;
> end;
>
> procedure TMapField.TimerHWinEvent(Sender: TObject);
> begin
> hwin.ReleaseHandle;
> TimerHWin.Enabled := False;
> end;
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz