Outdoor
Outdoor

Reputation: 35

Delphi VirtualStringTree OnGetHint

I want to show hint when cell text is already fully shown.
so, on form's OnCreate

procedure TForm1.FormCreate(Sender: TObject);
begin
  VirtualStringTree1.HintMode := hmHint;
  VirtualStringTree1.ShowHint := True;
end;

and OnGetHint

procedure TForm1.VirtualStringTree1GetHint(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex;
  var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: string);
begin
  HintText := IntToStr(Node.Index);
end;

but nothing happens.

OnGetHint event handler is not fired and even TBaseVirtualTree.CMHintShow breakpoint is not working.

what can I supposed to do?

I`m using delphi xe3, virtualtreeview 5.2.1.


Thanks for the answer.

I followed your guide.

Application properties

Vst propertiess

Vst events to implement

but nothing changed.
OnGetHint, OnGetHintSize, OnDrawHint are not fired at all.
(when HintMode set to hmToolTip and text is not fully shown, OnGetHint is fired only)

And yes, I read that documentation VirtualTreeView.pdf.
but all description about Event is exactly same as your quote.
I need more explanation.


Update:

Very weird thing.
I have tested this other PCs.

My PC Windows 10 xe3 vst 5.2.1

PC 1 Windows 10 xe3 vst 5.2.1

PC 2 Windows 10

What????
the code was not the problem.
I don't know why and even where to start.

anyway, I really thanks about answer and accept it.
if anyone knows about this weird thing, please let me know.
if I find out, I will update.

Upvotes: 3

Views: 1523

Answers (1)

Tom Brunberg
Tom Brunberg

Reputation: 21033

Several properties and event handlers must be in place/implemented for node specific hints to show. The following should get you started:

Application properties

  • ShowHint := True

Vst properties

  • Hint, e.g. 'Hint for the whole VST'
  • HintAnimation, e.g. hatNone
  • HintMode, e.g. hmHintAndDefault
  • ShowHint, True
  • ParentShowHint, as needed, use False if you don't know

Vst events to implement

  • OnDrawHint()
  • OnGetHint()
  • OnGetHintSize()

From the documentation:

Use an event handler for OnDrawHint() to draw the hint or tooltip for the given node. You must implement this event and OnGetHintSize() to get a hint at all.

Look on the net for VirtualTreeView.pdf for documentation

Upvotes: 3

Related Questions