Modal dialog for collecting text input from users with validation support.
Dialog1.Title := 'Enter Name';
Dialog1.Prompt := 'Please enter your name:';
Dialog1.DefaultValue := '';
Dialog1.Required := True;
if Dialog1.Execute = mrOK then
ShowMessage('Hello, ' + Dialog1.InputValue);
Dialog1.Title := 'Authentication'; Dialog1.Prompt := 'Enter your password:'; Dialog1.InputType := itPassword; Dialog1.Required := True; if Dialog1.Execute = mrOK then ValidatePassword(Dialog1.InputValue);
Dialog1.Title := 'Email Address';
Dialog1.Prompt := 'Enter your email:';
Dialog1.InputType := itEmail;
Dialog1.ValidationPattern := '^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$';
Dialog1.ValidationMessage := 'Invalid email format';
if Dialog1.Execute = mrOK then
SendEmail(Dialog1.InputValue);
Dialog1.Title := 'Comments'; Dialog1.Prompt := 'Enter your feedback:'; Dialog1.Multiline := True; Dialog1.MaxLength := 500; if Dialog1.Execute = mrOK then SaveFeedback(Dialog1.InputValue);
Dialog1.Title := 'Enter Age';
Dialog1.Prompt := 'How old are you?';
Dialog1.InputType := itNumber;
Dialog1.ValidationPattern := '^\d{1,3}$';
Dialog1.ValidationMessage := 'Please enter a valid age';
if Dialog1.Execute = mrOK then
Age := StrToInt(Dialog1.InputValue);
Execute - Show dialog and return result (mrOK or mrCancel)Validate - Manually validate current inputOnValidate - Custom validation handler (return True if valid)OnInputChange - Input text changedOnShow - Dialog appearsOnClose - Dialog dismissed