What you are trying to do in functional languages would be called partial application, where you take a function, fix the parameters and get a new function as a result that calls the existing function using those parameters.
In pascal this behavior can be approximated with function references, which are right now only available in the trunk of fpc. The problem is that you want to set an LCL event, and as far as I know they (currently) still use method pointers and not (the more generic) function references.
Thererfore, long story short, you can't do it this way. Potentially, as function references are just an interface internally, you can cast this to a method on that interface and this could work.
Here is how you need to do it right now (with current stable fpc): Create a new class which holds all the parameters for said function as fields. Then create you Method in that class that calls the function with the parameters stored as class fields
type
TUpdateGameDetailsCaller = class
private
FForm: TForm1;
FGamesList: TStringList;
FGameIndex: integer;
FGameDetail: TGameDetails;
FValue:string;
public
constructor Create(AForm: TForm1; GamesList: TStringList; aGameIndex: integer; aGameDetail: TGameDetails; aValue:string);
procedure Call(Sender: TObject);
end;
constructor TUpdateGameDetailsCaller.Create(AForm: TForm1; GamesList: TStringList; aGameIndex: integer; aGameDetail: TGameDetails; aValue:string);
begin
FForm := AForm;
FGamesList := GamesList;
FGameIndex := aGameIndex;
FGameDetail := aGameDetail;
FValue:string := aValue;
end;
procedure Call(Sender: TObject);
begin
FForm.UpdateGameDetails(FGamesList, FGameIndex, FGameDetail, FValue)
end;
And called with:
CreateLabelEditBox(Label1,@TUpdateGameDetailsCaller.Create(list, ListBox1.ItemIndex, gdTitle, edLabelEdit.text).Call);
How to free the temporary object afterwards is something you can findout yourself. Thats the hard part (because manual memory management sucks)