Problem with TAdvListBox and GetItemAtXY


I'm trying to show individual hints for each ListBoxItem using following code:

procedure TfLohnabrechnung.LB_LAR_MAListMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

   tmpItem :TListBoxItem;


   tmpItem := LB_LAR_MA.GetItemAtXY(X,Y);

   LB_LAR_MA.ShowHint := False;

   if tmpItem = nil
    then LB_LAR_MA.Hint := 'bitte Mitarbeiter auswählen'
    else LB_LAR_MA.Hint := tmpItem.Text;

   LB_LAR_MA.ShowHint := True;


The problem: The function returns everytime the first item of the listbox (Index0), so the hint shows always the text of Item[0].

Could someone please help me?

DELPHI XE5 Enterprise

TMS ComponentPack


Does this mean that LB_LAR_MA.GetItemAtXY(X,Y); always returns item 0 ?


I also still tried it directly with SendMessage(Handle, LB_ITEMFROMPOINT,0, MakeLParam(X,Y));

Resulting Index: always 0 ... whether the mouse was over an item or not ...

I see that Handle you use must be wrong. This is a compound component and the internal listbox handle should be used. This isn't exposed right now. We'd need to extend the component to expose this.