Scalabium Software

SMExport advertising
Knowledge for your independence'.
Home Delphi and C++Builder tips


#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:
1. we must create a dialog using CreateMessageDialog
2. this function will return a form object with dialog
3. in this object we can add a checkbox
4. show diallog using ShowModal
5. to check a result and process a state of our checkbox
6. to destroy a created checkbox and dialog object

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; 


Published: December 7, 2000

See also
 
ABA Database Convert
Paradox ActiveX
SMImport suite
Database Information Manager
ABA Document Convert
Metafile Convert
DBLoad
Protected Storage Viewer
Paradox Password Recovery
Fast Document Viewer
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2024, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising