Lazarus - Show differents hints for every column in a TListView

93 Views Asked by At

I have a TListView with 4 columns and I would like that when hovering over the title bar, a different hint is shown for each column. I have tried the following...

procedure TfConsolidados.lstDisponiblesMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if (X=lstDisponibles.Columns[0].Index) then
    lstDisponibles.Hint:='Incidencias'
  else if (X=lstDisponibles.Columns[2].Index) then
    lstDisponibles.Hint:='Incluida en hoja de ruta'
  else
    lstDisponibles.Hint:='';
end;

I'm starting in this programming and I would need your help.

Thank you very much.

1

There are 1 best solutions below

0
Dmitry Grigoryev On

X and Y are screen coordinates in pixels relative to top left corner of the control. You compare X with column widths to find out which column the user is hovering:

  if X < myList.Columns[0].Width then
    myList.Hint := 'first column'
  else if X < (myList.Columns[0].Width + myList.Columns[1].Width) then
    myList.Hint := 'second column'
  // ...etc