Mega Code Archive

 
Categories / Delphi / Forms
 

Add the custom component in the Message dialog

Title: Add the custom component in the Message dialog Question: How to show a message box that contain a "Don't show this message again." check box? Answer: Using CreateMessageDialog function and add your custom components before ShowModal called. example: procedure TForm1.Button1Click(Sender: TObject); Var AMsgDialog: TForm; ACheckBox: TCheckBox; begin AMsgDialog := CreateMessageDialog('This is a test message.', mtWarning, [mbYes, mbNo]); ACheckBox := TCheckBox.Create(AMsgDialog); with AMsgDialog do try Caption := 'Dialog Title' ; Height := 169; With ACheckBox do begin Parent := AMsgDialog; Caption := 'Don''t show me again.'; top := 121; Left := 8; end; Case ShowModal of ID_YES: ;//your code here after dialog closed ID_NO: ; end; If ACheckBox.Checked then begin //... end; finally ACheckBox.Free; Free; end; end; Also, you can customize the messagedialog which you like.