Hi,
With TAdvListView I'm trying to set up a mouse hover hint that changes depending on the row hovered over. I believe the info tip is the way to do this, but the OnInfoTip event does not fire.
ViewStyle is vsReport. I'm using OwnerData. ShowHint is set to true.
Thx.
I retested this here with a default TAdvListView on the form and the code
procedure TForm1.AdvListView1InfoTip(Sender: TObject; Item: TListItem;
var InfoTip: string);
begin
outputdebugstring(pchar('infotip:'+item.Index.ToString));
infotip := 'hint returned from event for item ' + item.Index.ToString;
end;
procedure TForm1.FillListView;
var
I: Integer;
Item: TListItem;
begin
// Ensure the listview has 3 columns
AdvListView1.Columns.Clear;
AdvListView1.Columns.Add.Caption := 'Column 1';
AdvListView1.Columns.Add.Caption := 'Column 2';
AdvListView1.Columns.Add.Caption := 'Column 3';
AdvListView1.Items.BeginUpdate;
try
AdvListView1.Items.Clear;
for I := 1 to 10 do
begin
Item := AdvListView1.Items.Add;
Item.Caption := 'Row ' + I.ToString + ' - Col 1';
Item.SubItems.Add('Row ' + I.ToString + ' - Col 2');
Item.SubItems.Add('Row ' + I.ToString + ' - Col 3');
end;
finally
AdvListView1.Items.EndUpdate;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AdvListView1.ViewStyle := vsReport;
AdvListView1.Columns.Clear;
AdvListView1.Columns.Add;
AdvListView1.Columns.Add;
AdvListView1.Columns.Add;
FillListView;
end;
but this shows the hint that was set via the OnInfoTip event:
DOH Sorry, I just noticed the relevant form has an attached secondary form which had focus, this stops the hints from showing on the first form. It's working now.
However the hint does still only show when hovering over the main item. Hovering over subitems shows the subitem text in hints, and this disappears completely if the column has its width set.
Thanks.
OnInfoTip is a Windows operating system implementation from the underlying Windows ListView class. It triggers for the main item only.
If you need a different hint for different subitems, this isn't possible via the OnInfoTip event.
To address this request, we have introduced the OnHint event with parameters item, subitem index and from where you'll be able to set a custom hint for both the main item & the sub items.
This new OnHint event will be in the next release.
That sounds perfect thx.
