API - colocar um checkbox numa tela padrao do Windows |
Top Previous Next |
// 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:
// Como colocar um checkbox ou qualquer componente em janelas padrão do Windows (MessagesBoxes?) // Este exemplo coloca um checkbox "Não mostre isso novamente" numa tela de alerta do Windows
procedure TForm1.Button1Click(Sender: TObject); var AMsgDialog: TForm; ACheckBox : TCheckBox; begin AMsgDialog := CreateMessageDialog('Mensagem de Teste.', mtWarning, [mbYes, mbNo]); ACheckBox := TCheckBox.Create(AMsgDialog); with AMsgDialog do try Caption := 'Titulo deste form' ; Height := 129;
with ACheckBox do begin Parent := AMsgDialog; Caption := 'Não mostre isso novamente'; Top := 86; Left := 8; Width := 150; end;
case ShowModal of ID_YES: ; // your code here after dialog closed ID_NO : ; end;
if ACheckBox.Checked then begin // Não mostra novamente marcado?... end; finally ACheckBox.Free; Free; end; end;
// Also, you can customize the messagedialog which you like.
|