ShowModal (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This code brings up the modal dialog from Unit2 when a button is clicked. It causes a Beep if the OK button is clicked. Implement the modal form in Unit2 and then put Unit2 in the uses clause for this module.

Code

#include "Unit2.h"
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if (MyDialogBox1->ShowModal() == mrOk)
    MessageBeep(0);
}

Uses