views:

123

answers:

1

I have a 'hint window leftovers' problem with Virtual Treeview in an Office add-in, and now I want to customize the hint window to solve the problem. I want to use TJvBallonHint from the JVCL package, which is also used in other parts of my program.

I inherited TVirtualStringTree and have overridden the GetHintWindowClass method like the following code. The TJvBallonHint window class is applied, but the hint text is not drawn. Any tips for me? Thank you!

function TMyStringTree.GetHintWindowClass: THintWindowClass;
begin
  Result :=TJvBalloonWindow;;
end;
A: 

The custom class should inherit from TVirtualTreeHintWindow which TJvBalloonWindow is not.

It is not formally required since it should be just THintWindowClass but look at code of TVirtualTreeHintWindow - it even doesn't use Caption (that's why your hint's caption is empty):

procedure TVirtualTreeHintWindow.CMTextChanged(var Message: TMessage);
begin
    // swallow this message to prevent the ancestor from resizing the window (we don't use the caption anyway)
end;

I suggest you to create new hint window class using code from TJvBalloonWindow for painting.