Lazarus

Programming => General => Topic started by: M[a]nny on August 05, 2010, 11:42:45 am

Title: What event to use?
Post by: M[a]nny 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.
Title: Re: What event to use?
Post by: BlueIcaro 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:

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

/BlueIcaro
TinyPortal © 2005-2018