Scalabium Software |
|
| Knowledge for your independence'. | |
#107: How can I add a custom control in standard dialog? |
|
Today I found a good example how we can add a some control in standard MessageDialog. For example, we have a some dialog for confirmation but user can check a checkbox (Don't show this message again) and in the next time this dialog will not show. The idea of realization in the next: View a source: 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;
if (ShowModal = ID_YES) then
begin
if ACheckBox.Checked then
begin
//...
end;
//... some additional processing
end;
finally
ACheckBox.Free;
Free;
end;
end;
|
|
Copyright© 1998-2025, Scalabium
Software. All rights reserved. |