unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Label1: TLabel;
    ListBox2: TListBox;
    procedure Button1Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var iloscw:integer;
begin
  with ListBox2 do
  for iloscw:=0 to Items.Count-1 do
     if Selected[iloscw] then
           Items[iloscw]:=Inttostr(StrtoInt(Items[iloscw])+1);
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  with ListBox1 do // ItemIndex=-1 jeśli nie wybrano żadnego elementu
     Items[ItemIndex]:=InttoStr(StrtoInt(Items[ItemIndex])+1);
end;

end.
