assign a function to a button-->error lazarus / 13-General ---------------------------------------------------------------------- slai · 2007-02-14 13:23 Hey there I've got a problem, i don't know how i can assign a function to a button in an array. my function: Code: [Select]                   iButtons := iButtons+1;                   setlength(Buttons,length(Buttons)+1);                   Buttons[iButtons] := TButton.Create(nil);                   Buttons[iButtons].Caption := SLFeldListe[i];                   Buttons[iButtons].Parent := panels[i];                   Buttons[iButtons].Left := 200;                   Buttons[iButtons].Top := round(((panels[i].Height)/2)-((Buttons[iButtons].Height)/2));                   TButton(Buttons[iButtons]).OnClick := @ButtonVerkaufpreisClick; on the line Code: [Select]TButton(Buttons[iButtons]).OnClick := @ButtonVerkaufpreisClick; fbc gives me an error: Unitdynamischedarstellung.pas(309,57) Error: Incompatible types: got "
" expected "" what am i doing wrong? thank you very much greets andrew ---------------------------------------------------------------------- Vincent Snijders · 2007-02-14 15:52 ButtonVerkaufpreisClick should be a method of an object for example the form. ---------------------------------------------------------------------- slai · 2007-02-14 16:23 thank you very much it works....