Guest Posted February 22, 2022 (edited) type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private //TInputCloseQueryEvent = procedure (Sender: TObject; const Values: array of string; var CanClose: Boolean) of object; procedure MyInputCloseQueryEvent(Sender: TObject; const Values: array of string; var CanClose: boolean); public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.MyInputCloseQueryEvent(Sender: TObject; const Values: array of string; var CanClose: boolean); begin if not(Sender = nil) then ShowMessage('Sender is a: ' + Sender.ClassName); // // what do with this values? for var MyItem in Values do ShowMessage('MyItem = ' + MyItem); // CanClose := true; // yes or not? end; procedure TForm1.Button1Click(Sender: TObject); var MyPrompts : TArray<string>; MyValues: TArray<string>; begin MyPrompts := ['p1', 'p2', 'p3']; MyValues := ['q1', 'q2', 'q3']; // InputBox('caption', 'prompt', 'default value') use "InputQuery() behind scenes. if InputQuery('Caption', MyPrompts, MyValues, MyInputCloseQueryEvent { or nil } , Self { TForm1... or nil } ) then ShowMessage('What to do now?'); end; Edited February 22, 2022 by Guest Share this post Link to post