Author Topic: What event to use?  (Read 3296 times)


  • Full Member
  • ***
  • Posts: 130
  • Dreamer
What event to use?
« on: August 05, 2010, 11:42:45 am »
Hello good people.

Imagine Form with ListView and 3 Buttons (Add, Edit, Delete). You are allowed to add item anytime you want. You are allowed to edit or delete item while item is selected ONLY. What event would I use? All i want to do is to make property Buttons.Enabled := False when none item is selected and when user select some item (ListView.ItemIndex > -1) then Buttons.Enabled := True. I tried this with timer, but it is not very smart solution, i think.
Bad news: Time flies.
Good news: You are the pilot.

Don't try to be perfect, just be unique.


  • Hero Member
  • *****
  • Posts: 749
    • Blog personal
Re: What event to use?
« Reply #1 on: August 05, 2010, 01:22:33 pm »
Hello, try to start your application with the 3 buttons enabled := false;

Use the Onclick event of the ListView, something like this:

procedure TForm1.ListView1Click (Sender: TObject );
   Button1.enabled := ListView1.Selected <> Nil;



TinyPortal © 2005-2018