ItemIndex should be the item which has the focus. try this code (or similar) to see if it works:
function GetCurrentItem(AListBox: TListBox): String;
var
idx: Integer;
begin
{ The important thing: use an intermediary to
isolate calls to the list box methods }
idx := AListBox,ItemIndex;
if idx <> -1 then
Result := AListBox.Items[idx];
else
Result := '';
end;
Alternatively, if you have
MultiSelect set to
False, you can use
AListBox.GetSelectedText, which does esentially the same but internally.
If nothing works, please, be more specific: what does it do which is wrong? which steps to reproduce the fail?
which OS and which version of Lazarus/FPC? (this last is in your signature, I guess)
ETA: Damn, you guys are quick!