Showing TeeTree hints
Showing TeeTree hints
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.
Hi,
You could use the following code:
Regards,
tom
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;
tom
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.
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.
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.
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.