Showing TeeTree hints

TeeTree VCL for Borland Delphi and C++ Builder.
Post Reply
Saphire
Newbie
Newbie
Posts: 3
Joined: Mon Jan 31, 2005 5:00 am

Showing TeeTree hints

Post by Saphire » Fri Mar 24, 2006 7:02 pm

I have a need to show the hint message when the mouse is over a TTreeNodeShape and the entire shape is in view. This is due to Zooming to the point that description is unreadable. I have been unable to figure out how to get around the CancelHint call during the mouse move. By the way for future versions I would concider a property that would turn off the bounds checking for the showhint.

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Mon Mar 27, 2006 5:31 pm

Hi,

You could use the following code:

Code: Select all

procedure TForm2.Tree1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
  var  MyNode : TTreeNodeShape;
begin
    MyNode := Tree1.ClickedShape(X,Y);
    If MyNode<>Nil then begin
      if MyNode.Text.Count  > 0 then
        Tree1.Hint := MyNode.Text[0];
    end;
  end;
end;
Regards,
tom

Saphire
Newbie
Newbie
Posts: 3
Joined: Mon Jan 31, 2005 5:00 am

Post by Saphire » Thu Apr 06, 2006 10:27 pm

Thanks Tom.

That was what I was doing and it doesn't work. By the time TeeTree calls my mousemove event handler it has already determined that the object is completely displayed on the screen and called the CancelHint system routine. I set the hint text but the hint doesn't show. At least I am assuming the CancelHint call is the reason. There might be something else.

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Wed Apr 12, 2006 6:04 pm

Hi,

Be sure ShowHintShapes is set to False

This is okay, since you handle the hint yourself, so if the shape is only partly visible it's hint is handled by your code too

Saphire
Newbie
Newbie
Posts: 3
Joined: Mon Jan 31, 2005 5:00 am

Post by Saphire » Fri Apr 21, 2006 2:35 pm

Thanks Tom. That was the last hint I needed to get it to work. I had to add a little more to make it work. So for others looking to do the hint control in their own application let me give my final solution.

In the form's OnCreate I entered the statement:
ttree1.ShowHintShapes := False;

I then have the following OnMouseMove code.

Code:
procedure TForm1.ttree1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var MyNode : TTreeNodeShape;
begin
MyNode := ttree1.ClickedShape(X,Y);
If Assigned(node) then begin
if MyNode.Text.Count > 0 then
begin
Application.HintShortPause := 0;
Application.HintPause := 0;
ttree1.Hint := MyNode.Text[0];
ttree1.ShowHint := True;
end
else
begin
ttree1.Hint := '';
Application.CancelHint;
end;
end;
end;
end;

Thanks for your insight and help.

Post Reply