TListView.OnEdited enigma
Hi folks!
I've got a strange problem:
Consider that I have a TListView called lv, and clicking on it, I'll add a
ListItem and put it on Edit state calling EditCaption method.
Since I just want to continue my procedure after the item was edited, I've
created a global var named "ok", and after calling the EditCaption method, I
did a looping to wait this var went to true. Ok is set to true on the
TListView.OnEdited event handler.
Problem:
Until here, everything is fine, everything works, but when I click on the
listview and simply press ENTER, without writing anything on the
listitem.caption, it don't call onEdited event handler, and worse, it never
close the looping.
The source code is beneath:
var
ok: boolean;
procedure TForm1.lvClick(Sender: TObject);
var
added: TListItem;
begin
added := lv.Items.Add;
ok := false;
added.EditCaption;
while not ok do
Application.ProcessMessages;
showmessage('Item inserted');
end;
procedure TForm1.lvEdited(Sender: TObject; Item: TListItem; var S: String);
begin
ok := true;
end;
thanks
Padu