- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Forcing edit mode in a TListView via a keypress

Question:

When the user clicks on a caption in the listview, it goes into edit mode. How can I force the edit mode by pressing F2 or a similar key?

Answer:

The following example demonstrates trapping the F2 key in a
Listview control and forcing the caption into edit mode.

Example:

procedure TForm1.ListView1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Ord(Key) = VK_F2 then
    ListView1.Selected.EditCaption;
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile